Giter VIP home page Giter VIP logo

oren's Introduction

Restaurant API

This is an api that implements oren backend developer tests. It is an express app with mongodb as the backend. The schemas can be found in models while business logic in controllers. Routes manages the exposed endpoints. It uses jsonwebtoken for login tokens, and express-validator to validate the request body. It is written in a model-controller architecture.

Models

The models available are:

  • Cart: This is a mongoose model for the cart contents
  • User: This is the mongoose model for the user data (email, password, etc.)
  • DB: This gives the connect(), and close() method to manage connection with the Mongo database
  • Dishes: This model responds with the hardcoded values of two items, Dishes & Beverages
  • Mailer: Sends the order email

Controllers

The controllers are:

  • cartController: it has methods to get items(/cart/items), add a new item (/cart/add), increment item (/cart/increment), decrement an item (/cart/delete) or delete an item regardless of quantity (/cart/delete/all). It also has (/cart/order) which sends an email of the complete order to the customer
  • userController: it has methods to get profile (/user/profile), login (/user/login), register(/user/register), edit profile (/user/edit)

Routes

The routes are:

  • cart
  • menu: this has one get method (/dishes) which returns all the menu items
  • users

All constants are stored in config.js file in the root folder.

Run

  • Install dependencies npm install
  • Run the app by npm start or node ./bin/www

oren's People

Contributors

zen93 avatar

Watchers

 avatar

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.