README

Nodejs + Couchbase + Angular sample app

Install

//start your couchbase server.app beforehand npm install node app.js //http://localhost:3000

REST API DOCUMENTATION

GET /api/airport/findAll?search=<search string> [RETURNS: {"airportname":"<airport name>"} for typeahead airports passed in the query string in the parameter "search"]

--Used for Typeahead
--Queries for Airport by Name, FAA code or ICAO code.

GET /api/flightPath/findAll?from=<from airport>&to=<to airport>&leave=<leave date>&ret=<return date> [RETURNS: {"sourceairport":"<faa code>","destinationairport":"<faa code>","name":"<airline name>","equipment":"<list of planes airline uses for this route>"} of available flight routes]

--Populates the available flights panel on successful query.
--Queries for available flight route by FAA codes, and joins against airline information to provide airline name.

POST /api/user/login request body {"user":<user>,"password":<encrypted password>} [RETURNS:{encrypted JSON Web Token}]

--Creates a new user.
--Returns an Encrypted JSON Web Token used by the Application

GET /api/user/login?user=<user>&password=<encrypted password>[RETURNS:{<success or failure>:<error or encrypted JSON Web Token>}]

--Logs in a user
--Returns success and JSON Web Token OR failure and error message

POST /api/user/flights request body {"token":<JSON Web Token>,"flights":<group of flights to book>} [RETURNS:{"added":<number of flights booked in this request>}]

--Checks if user is logged in from the JSON Web Token and then if token is correct it will book the list of flights passed in.
--Returns number of flights added if successful, or error.

POST /api/user/flights?token=<JSON Web Token> [RETURNS:{list of flights previously booked specific to user}]

--Checks if the user is logged in from the JSON Web Token and then if token is correct it will return a list of previously booked flights.
--Returns JSON Array of Documents of previously booked flights, or error.