SkyRoute is a Node.js-based API designed to manage various aspects of flight operations, including airports, cities, airplanes, and seats. The project follows best coding practices and project management recommendations to ensure scalability and maintainability.
- Flight Management: CRUD operations for flights, including scheduling and allocation.
- Airport and City Management: Manage airports and cities to support flight operations.
- Airplane and Seat Management: Handle airplane details and seat configurations.
- Search Functionality: Filter flights based on parameters like price, departure, and arrival airports.
- Microservices Architecture: Designed for reliability and scalability.
Flights-Service/
│── src/
│ ├── config/ # Configuration settings for libraries and modules
│ ├── routes/ # API route definitions
│ ├── middlewares/ # Request interceptors (validators, authenticators, etc.)
│ ├── controllers/ # Handle requests and interact with the business layer
│ ├── repositories/ # Handle database queries (ORM or raw SQL)
│ ├── services/ # Business logic layer
│ ├── utils/ # Helper functions, error classes, etc.
│── migrations/ # Sequelize migrations (created after initialization)
│── seeders/ # Sequelize seeders (created after initialization)
│── .env # Environment variables
│── package.json # Project dependencies and scripts
│── README.md # Documentation
-
Clone the repository:
git clone https://github.com/swraj28/Flights-Service.git cd Flights-Service -
Install dependencies:
npm install
-
Set up environment variables:
- Create a
.envfile in the root directory. - Add the following variables:
Replace
PORT=3000 DB_USERNAME=<your_db_username> DB_PASSWORD=<your_db_password> DB_NAME=<your_db_name> DB_HOST=127.0.0.1 DB_DIALECT=mysql
<your_db_username>,<your_db_password>, and<your_db_name>with your database credentials.
- Create a
-
Initialize Sequelize (for database migrations):
npx sequelize init
This will generate
migrations/,seeders/, andconfig/config.jsoninside thesrc/config/folder. -
Configure database settings:
- Open
src/config/config.json. - Update the
development,test, andproductionsections with your database credentials.
- Open
-
Run database migrations:
npx sequelize db:migrate
-
Run seeders (optional):
npx sequelize db:seed:all
-
Start the development server:
npm run dev
To run tests, execute:
npm testWe welcome contributions! If you have suggestions for improving this project, feel free to fork the repository, create a new branch, and submit a pull request.
This project is licensed under the MIT License.