social-platform-donut-backend
STEPS
npm install
Package descriptions
- bcrypt :- hash your plain password and store hashed password in database.
- body-parser :- Parse incoming request bodies in a middleware before your handlers, available under the req.bodyproperty.
- express :- Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications.
- jsonwebtoken :- JSON Web Token (JWT) is an open standard (RFC 7519) that defines a compact and self-contained way for securely transmitting information between parties as a JSON object.
- mongoose :- Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.
- morgan :- HTTP request logger middleware for node.js.
- nodemon :- nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application.
These are the Donut APIs
API Response Format
The response body for all the APIs will use the following format and it will contain one of them ( data | errors ).
{ data: { /../ }, errors: { /../ } }
Error Objects
Error objects provide additional information about problems encountered while performing an operation. Error objects MUST be returned as an array keyed by errors in the top level of a JSON:API document.
An error object MAY have the following members:
status
: the HTTP status code applicable to this problem, expressed as a string value.code
: an application-specific error code, expressed as a string value.title
: a short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.detail
: a human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized.
Allowed HTTPs requests:
POST : To create resource PATCH : To Update resource GET : Get a resource or list of resources DELETE : To delete resource
Description Of Donut API Server Responses:
Code | Name | Details |
---|---|---|
200 |
OK |
the request was successful. |
201 |
Created |
the request was successful and a resource was created. |
204 |
No Content |
the request was successful but there is no representation to return (i.e. the response is empty). |
400 |
Bad Request |
the request could not be understood or was missing required parameters. |
401 |
Unauthorized |
authentication failed or user doesn't have permissions for requested operation. |
403 |
Forbidden |
access denied. |
404 |
Not Found |
resource was not found. |
405 |
Method Not Allowed |
requested method is not supported for resource. |
409 |
Conflict |
resourse with given id already exist. |