This is a test application to demonstrate the following:
- Explore the NASA EONET API
- Create a single API route that will accept month and year query parameters and returns all wildfire events that ended in that particular month.
- Scalabe application structure
- Test driven development
Make sure your environment has the following installed:
- Nodejs (version - 16^)
- Docker (You need docker to be installed to run application)
To clone this repo onto your local machine:
-
Clone the repository from GitHub Repo URL.
git clone https://github.com/mayorscript/wildfire-inventory-api.git
-
To get started, navigate to the project directory:
cd wildfire-inventory-api
-
Install project dependencies:
yarn install
-
Run docker compose:
docker compose up
-
To test:
yarn test
The project follows a standard directory structure:
wildfire-inventory-api/
│
├── dist/ # Output folder for compiled Javascript files
├── logs/ # Auto-generated app logs
├── src/ # Source code
|── config/ # App configuration
└── ...
|── controllers/ # Http request
│ └── ...
|── lib/ # Utility functions & API Services
└── ...
|── middlewares/ # App middlewares
│ └── ...
|── routes/ # App routes
│ └── ...
|── schema/ # Validation schema
│ └── ...
|── services/ # App business logic
│ └── ...
|── types/ # Typescript type declarations
│ └── ...
|── index.ts # App entry point
|── server.ts # Server setup
├── .env.test # Test environment variable
├── package.json # Project dependencies and scripts
├── README.md # Project documentation
└── ...
Starting from the root directory of your local repository, run:
The src
folder contains the project's package.json
file, index.ts
which is the entry point to the application, and a .env
file for managing environments.
The NODE_ENV
variable in the .env
file is used to set the application's environment configuration. As listed by the files within src/config
, NODE_ENV
can take one of 4 possible values: local
, development
, production
- and if NODE_ENV
is not set, the application uses the default
configuration. For example, you can set the application to use the local
configuration by updating .env
with:
NODE_ENV=local
Do not add secrets directly into .env
; any secret values should be managed by a Secret Manager.
- Node.js
- Express.js
- Docker
- Axios
- Winston
- Nodemon
- Jest
- Husky
- Github Actions
This project is licensed under the MIT License.