Skip to content

🍜 Web API server that shows restaurant's available dishes and makes users able to like and comment on them.

Notifications You must be signed in to change notification settings

jay-liu-x/conFusionServer

Repository files navigation

Con Fusion Server

This is the backend server for a restaurant named Con Fusion, a practice project for learning backend development with JavaScript.

Technologies

Tech Function
Node.js Runtime
Express.js application framework
MongoDB persistent data store
Mongoose ODM (object-document mapper)
JsonWebToken Authentication

Authentication

It uses simple JWT-based authentications, and APIs are as following:

Operation Method URL Body
Signup POST /users/signup { "username": "abc", "password": "xyz" }
Login POST /users/login { "username": "abc", "password": "xyz" }
Logout (not used) GET /users/logout

When you login, you'll receive a token in the response body. Put that token in the request header as Authentication: Bearer <token> to access restricted endpoints. The default expiration time of the tokens in 1 hour. You'll have to relogin and obtain new token when the current token expires.

API Endpoints

Endpoint Supported methods
/dishes GET, POST, DELETE
/dishes/<dishId> GET, PUT, DELETE
/dishes/<dishId>/comments GET, POST, DELETE
/dishes/<dishId>/comments/<commentId> GET, PUT, DELETE
/promotions GET, POST, DELETE
/promotions/<promoId> GET, PUT, DELETE
/leader GET, POST, DELETE
/leader/<leaderId> GET, PUT, DELETE
/users GET

Method documentation

Method Description Access Control
GET Retrieve record(s) Usually public
POST Insert new record in the collection Requires authentication
PUT Modify a record Requires authentication
DELETE Delete record(s) Requires authentication

Reference

About

🍜 Web API server that shows restaurant's available dishes and makes users able to like and comment on them.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published