Skip to content

Source code for the project Mr Fluffy Fluffs

License

Notifications You must be signed in to change notification settings

Aiyan6/Mr-Fluffy-Fluffs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mr-Fluffy-Fluffs

Source code and offical API documentation for the project Mr Fluffy Fluffs.

The backend is implemented as standard Stateless REST API. However, session management has been done on top of that for CSRF protection and exposing data like user credentials publicly.

Base URL

http://mr-fluffy-fluffs.herokuapp.com/

Routes

Every route is preceded by /api/[route]. There are four main routes for fetching and sending data to the API.

  • Common
  • User
  • Admin
  • Guest

Note that any method (route) requiring any admin or user previliges is written in the following format.
Method [Admin]
Method [User]

Routes List and Methods

Every routes requiring parameters e.g [/:id], must be provided with mongoose unique document id.

Common

  • get api/common/menu

  • get api/common/menu/:id

  • get api/common/toppings

  • get api/common/toppings/:id

  • get api/common/fillings

  • get api/common/fillings/:id

  • get api/common/custom

  • put api/menu [Admin]

  • put api/toppings [Admin]

  • put api/fillings [Admin]

  • patch api/menu/:id [Admin]

  • patch api/toppings/:id [Admin]

  • patch api/fillings/:id [Admin]

  • delete api/menu/:id [Admin]

  • delete api/toppings/:id [Admin]

  • delete api/fillings/:id [Admin]

User

  • post api/login

  • post api/logout [User]

  • get api/user [Admin]

  • get api/user/:id [Admin]

  • get api/user/id/cart

  • get api/user/id/cakes

  • get api/user/id/cakes/id

  • put api/user/

  • put api/user/id/cart

  • put api/user/id/cakes

  • delete api/user/:id [Admin]

  • delete api/user/:id/cart/:itemid [Admin]

  • delete api/user/:id/cart

  • delete api/user/id/cakes/:cakeid

  • delete api/user/:id/cakes

  • patch api/user/:id [User]

Admin

  • get /api/admin/ [Admin]

  • get /api/admin/:id [Admin]

  • post /api/admin/login

  • post /api/admin/logout [Admin]

  • put /api/admin [Admin]

  • delete /api/admin/:id [Admin]

  • patch /api/admin/:id [Admin]

Guest

  • post /api/guest/login
  • post /api/guest/logout

Requests

All the requests requiring body parameters to pass to api with request should be passed as JSON object.

  • Adding pancake

{ "pancake": { "Name": "Admin Pancake", "Description": "This is a pancake from admin.", "Price": 1250 } }

  • Signing up a Customer

{ "customer":{ "FullName":"abc", "Username":"asd", "PassHash":"1233434", "Address":"asdasdsdd", "Email":"[email protected]", "MobileNo":123456 } }

Response

The api send response in JSON format alongwith Status code.

  • Fetching fillings

{ "status": "True", "msg": "Fillings", "data": [ { "_id": "5e9efed8eb2b5c27128eeead", "Name": "Chocolate Chips ", "Price": 50, "__v": 0 }, { "_id": "5ea009c7109ca0246b9e1566", "Name": "New filling", "Price": 230, "__v": 0 }, { "_id": "5ea009d4109ca0246b9e1567", "Name": "Small", "Price": 1000, "__v": 0 } ] }

  • Fetching one filling

{ "status": "True", "msg": "Filling found.", "data": { "_id": "5ea009c7109ca0246b9e1566", "Name": "New filling", "Price": 230, "__v": 0 } }

About

Source code for the project Mr Fluffy Fluffs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 97.9%
  • HTML 2.1%