akhilome / fast-food-fast

Food ordering and delivery application. API built with Node + Express (Tests w/ Mocha, Chai + chai-http) connected to a Postgres DB. Frontend built with HTML/CSS & Vanilla JS

Home Page:https://kiakiafood.herokuapp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KiaKiaFood

Build Status Coverage Status Maintainability Test Coverage

Getting Started

Make sure you have NodeJS (>8.12.0), NPM (>6.4.1), and PostgreSQL (>10.5) installed.

Clone the project repo and cd into it:

git clone https://github.com/akhilome/fast-food-fast.git && cd fast-food-fast

Install the project dependencies:

npm i

Setup required environmental variables

Rename the .env.example file to .env and replace the placeholders with valid data.

Setup database

With your database server running and you being in the project's root directory run the follow commands.

Setup database
npm run config-db && npm run seed-db
Setup test database
npm run setup-testdb

Start the app

npm start

then access any of the endpoints listed below

Working Endpoints

Endpoint Functionality Notes
POST /auth/signup Registers a User
POST /auth/login Login a user
POST /orders Place an order for food
GET /users/<userId>/orders Get the order history for a particular user.
GET /menu Get available menu
POST /menu Add an new meal to db Only admins can use this route
GET /orders Get all customer orders Only admins can use this route
GET /orders/<orderId> Get the details of a specific order Only admins can use this route
PUT /orders/<orderId> Update the status of an order Only admins can use this route

Required Payload

POST /auth/signup

{
  "name": "User's name",
  "email": "User's valid email",
  "password": "A password longer than 6 chars",
  "confirmPassWord": "The above password, again",
  "adminSecret": "secret key for signing up admins [optional]"
}

POST /auth/login

{
  "email": "valid email address",
  "password": "valid password"
}

POST /orders

{
  "foodIds": [1, 2, 3]
}

POST /menu

{
  "foodName": "Name of new food",
  "foodImage": "URL of food image",
  "price": "Numeric price of food item"
}

PUT /orders/<orderId>

{
  "status": "new status"
}

Note: the status passed to this route should be either of:

  • complete
  • processing
  • cancelled

Running Tests locally

Having setup the testdb above (npm run setup-testdb) you can run the test locally by running ...

npm test

... from the command line

Deployment

Tecnologies Used

Acknowledgements

About

Food ordering and delivery application. API built with Node + Express (Tests w/ Mocha, Chai + chai-http) connected to a Postgres DB. Frontend built with HTML/CSS & Vanilla JS

https://kiakiafood.herokuapp.com


Languages

Language:JavaScript 71.4%Language:HTML 12.6%Language:CSS 8.6%Language:API Blueprint 6.8%Language:TSQL 0.7%