Giter Site home page Giter Site logo

flightapp-api's Introduction

Travis CI

URLs

The backend system is deployed to here

The API documentation can be inspected here

The build logs - Travis CI

Key Technologies

Core

  • Node.js v8.11.2
  • Express.js v4.16.4

Databases

  • PostgresSQL
  • Sequelize

Testing

  • mocha
  • chai

Setup

Prerequisite

  • Homebrew (MacOS)
  • Chocolatey (Windows)

Node

  1. Install nvm with brew install nvm.
  2. Install node 8.11.2 with nvm install 8.11.2.
  3. From the root directory of this project, run nvm use 8.11.2.
  4. Run npm install

Database

  1. Install PostgreSQL on your local machine. The instructions for this very from operating system to operating system.
$ brew install postgresql
  1. Start PostgreSQL and run on startup.
$ brew services start postgresql
  1. Ensure a root user exists on PostgreSQL with no password:
$ psql --dbname=postgres
postgres=# CREATE USER root;
postgres=# ALTER USER root WITH SUPERUSER;
  1. Create the database by running:
$ npm run db:create
  1. Create the database tables by running:
$ npm run db:migrate

Testing

To run the tests, simply run

$ npm run test

To generate the code coverage

$ npm run test:coverage

flightapp-api's People

Contributors

burasdiana avatar chill5018 avatar mirch avatar moonflare avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

moonflare

flightapp-api's Issues

[HIGH PRIORITY] - Add data to the Database

Create a seed file to populate the database with some content. It is recommended that we use dates starting in february. So that this does not have to be updated for the exam.

Handle User Authentication

  • Define User Model
  • Name
  • Email
  • Password
  • Define User Relationships
  • User Has Many Bookings
  • User has Payment Details
  • Define Auth Endpoints
  • Use Bcrypt + JWT Token or Cookies for Auth.

Handle Payment Details

  • We need to securely store a users credit card / payment information
  • We need to securely pass this information between the client and the server. (Symmetric / Asymmetric Encryption + TLS)
  • Check Sum, to ensure the integrity of the credit card information

Define Models

{
  "originName": "Copenhagen",
  "originCode": "CPH",
  "destinationName": "New York City",
  "destinationCode": "JFK",
  // CPH, JFK, LGA, NWK, SWF (Norwegian)
  "airports": {
    "id": "int",
    "name": "String"
  },
  // Airline Selling Ticket (SAS, Norwegian, British Airways, American Airlines, Turkish Air)
  "airline": { 
    "id": "int",
    "name": "String",
    "offerIndex": ["OfferId - Int"]
  },
  // Ticket
  "offer": {
    "id": "int",
    "price": "Double - BaseCurrency [EUR, DKK, USD]",
    "flightIndex": ["flightId"]
  },
  // Booking
  "flight": {
    "id": "int",
    "airlineIndex": "airlineId",
    "flightNumber": "string",
    "departureDateTime": "timestamp",
    "arrivalDateTime": "timestamp",
    "destinationIndex": "airportId",
    "originIndex": "airportId"
  }
}

Reconfigure sequelize setup

Currently, we use 2 types of configs for the sequelize commands. We need to be consistent and only use config/config.json file and avoid using the .env files for that matter

Define Controllers With Endpoints

GET - api/v1/airlines --> Returns all available airlines with flights
POST - api/v1/airlines --> Create city with flights

GET - api/v1/airports --> Returns all available airports with flights
POST - api/v1/airports --> Create airport

GET - api/v1/cities --> Returns all available cities with flights
POST - api/v1/cities --> Create city with flights

Primary Endpoint
GET - api/v1/flights --> Returns all available flights

params: {
  "origin": "String",
  "destination": "String",
  "departureDate": "Long",
  "returnDate": "Long",
  "ticketCount": "Int"
}

POST - api/v1/flights --> Create flight

GET - api/v1/offers --> Returns all available offers with flights
POST - api/v1/offers --> Create offer

Update Readme

The Readme does not reflect our project. It needs to be updated.

How to initialize the project, how to run the project locally. Where to find the deployed version, a Link to the available routes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.