/Food-Reserve

API for reserving food with Node.Js , Express.Js , MongoDB and REST API

Primary LanguageJavaScript

Food Reserve API

This API made for university food system and use Node.js, Express.js, MongoDB, JWT and more...


Guide

There is no Frontend and UI to work with this API.so you must use appllications like postman to work with this project !

first execute below command to install all package needed:
npm install
Then make sure you have installed MongoDB on your system and mongod service is running then run project with this command:
node index
Web server start running on localserver and port 3000 by default.you can change the port in .env file.use below endpoints to with web server:

Endpoints:

Login

Method = GET
Route = /api/user
Pass these as query string in URL

  • username : string
  • password : string

Signup

Method = POST
Route = /api/user
Pass these in body as JSON

  • fullname : string
  • password : string

Edit User

***login needed

Method = PUT
Route = /api/user
Pass these in body as JSON

  • type : integer - range[0,5]
  • type = 0 => Update food code password
    • newCode : integer
  • type = 1 => Update username
    • newUsername : string
  • type = 2 => Update password
    • newPassword : string
  • type = 3 => Update email
    • newEmail : string
  • type = 4 => Promote user(admin)
    • targetUser : string
  • type = 5 => Demote user(admin)
    • targetUser : string

Increase Currency

***login needed

Method = POST
Route = /api/user/increase-currency
Pass these in body as JSON

  • amount : integer

Get Foods

***login needed

Method = GET
Route = /api/food
Pass these as query string in URL

  • year : integer
  • month : integer
  • day : integer

Create Foods

***login needed

Method = POST
Route = /api/food
Pass these in body as JSON

  • name : string
  • meal : integer range[1,5]
  • price : integer
  • locations : string[]
  • year : integer
  • month : integer
  • day : integer
  • hour : integer
  • minute : integer

Delete Foods

***login needed

Method = DELETE
Route = /api/food
Pass these in body as JSON

  • id : string

Reserve Foods

***login needed

Method = POST
Route = /api/food/reserve
Pass these in body as JSON

  • id : string
  • amount : integer
  • location : string