This project utilizes NestJS to provide an API for accessing international airport data sourced from OurAirports.
- Retrieves international airport data including name, location, country, and other relevant information.
- Provides endpoints for querying airports based on various parameters such as country, type, and location.
Before running this application, ensure you have the following installed:
- Node.js
- npm (Node Package Manager)
- MySQL server
- Clone this repository to your local machine:
git clone https://github.com/DyanGalih/nest-airports.git
- Navigate into the project directory:
cd nest-airports
- Install dependencies:
npm install
- Set up environment variables:
Create a .env
file in the root directory and add the following environment variables:
DB_HOST=your_mysql_host
DB_PORT=your_mysql_port
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password
DB_DATABASE=your_mysql_database
PORT=3000
Replace your_mysql_host
, your_mysql_port
, your_mysql_username
, your_mysql_password
, and your_mysql_database
with your MySQL database connection details.
- Start the server:
npm start
The server will start running on port 3000 by default. You can change the port by modifying the PORT
environment variable in the .env
file.
- Access the API:
You can now access the API at http://localhost:3000
.
Follow these steps to deploy the repository to your personal server:
-
Ensure your server meets the prerequisites mentioned above.
-
SSH into your server.
-
Clone the repository onto your server:
git clone https://github.com/DyanGalih/nest-airports.git
- Navigate into the project directory:
cd nest-airports
- Install dependencies:
npm install --production
- Set up environment variables:
Create a .env
file in the root directory and add the following environment variables:
DB_HOST=your_mysql_host
DB_PORT=your_mysql_port
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password
DB_DATABASE=your_mysql_database
PORT=3000
Replace your_mysql_host
, your_mysql_port
, your_mysql_username
, your_mysql_password
, and your_mysql_database
with your MySQL database connection details.
- Build the project:
npm run build
- Start the server:
npm run start:prod
Your API should now be deployed and accessible on your personal server.
You can find the API documentation here.
This project is licensed under the MIT License - see the LICENSE file for details.