Skip to content

singhvivekkumar/reminder-service-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Airline - API Gateway

I have built a backend system that support multiple feature of airline company.

This api gateway is backend for frontend

FRONT-END => MIDDLE-END => BACK-END

Introduction

This project follow microservice architecture and it has four services for specific logic and one api gateway where all repository mention below.

Technologies Used

  • NodeJS This is a cross-platform runtime environment built on Chrome's V8 JavaScript engine used in running JavaScript codes on the server.
  • ExpressJS This is a NodeJS web application framework.
  • MySql This is an open-source relational database management system (RDBMS) that is widely used for managing and organizing data.
  • Sequelize ORM This is a popular Object-Relational Mapping (ORM) library for Node.js. It provides a way to interact with relational databases such as MySQL, PostgreSQL, SQLite, and MSSQL using JavaScript..
  • Sequelize cli The Sequelize Command Line Interface (CLI) is a powerful tool for working with Sequelize, which is a promise-based Node.js ORM (Object-Relational Mapping) for PostgreSQL, MySQL, SQLite, and MSSQL.

Environment Setup:

Prerequisites:

**Please note: You make sure that all the service working properly before initialize API Gateway.

  1. Clone the repository:

    git clone https://github.com/singhvivekkumar/reminder-service-api
  2. Move to the backend folder:

    cd reminder-service-api
  3. Install and set up Docker.

    npm install

Create a .env file in the project's root directory.

The .env file should contain the following environment variables:

PORT=3003
EMAIL_ID=<USER_EMAIL_ID>
EMAIL_PASS=<USER_PASSWORD>
MESSAGE_BROKER_URL='amqp://localhost' #local server in your machine
EXCHANGE_NAME=AIRLINE_BOOKING
BINDING_KEY=REMINDER_BINDING_KEY

Start the Backend Server:

To start the backend server, run the following command:

npm start

REST API

Request to test api gateway

GET http://localhost:3005/api/home

Response

{ "message": "successfully hitted api gateway" }

Request to signup in airline

POST: http://localhost:3005/auth/api/v1/signup`` body: { email: test@gamil.com, password: 13245768 }`

Response to signin in airline

HTTP/1.1 201 Ok
Status: 404 Not Found
Connection: keep-alive
Content-Type: application/json

{
	"data": {
		"id": 8,
		"email": "<EMAIL_ID>",
		"password": "<ENCRYPTED_PASSWORD>",
		"updatedAt": "2023-11-24T18:27:28.189Z",
		"createdAt": "2023-11-24T18:27:28.189Z"
	},
	"success": true,
	"message": "Successfully user signed in website",
	"err": {}
}

Request to signup in airline

POST http://localhost:3005/auth/api/v1/signin body: { email: test@gamil.com, password: 13245768 }

Response to signin in airline

HTTP/1.1 200 Ok
Status: 404 Not Found
Connection: keep-alive
Content-Type: application/json

{
	"data": <JWT_TOKEN>,
	"success": true,
	"message": "Successfully user signed in website",
	"err": {}
}

Congratulations! Your backend is now running at http://localhost:3005/.