General

  1. Write clean codes, delete all non-usable codes
  2. Comment your codes
  3. Use meaningful names to name your variables
  4. The project files are already set, you follow the project concept
  5. All schema properties must start with a lowercase
  6. The naming convention is lowercase
  7. All model must record created and modified timestamp
  8. You have to use proper pagination with Mongoose aggregate
  9. We prefer you to make more use of aggregate

Documentation

We use Postman for documentation. Each of the application screens will be a folder in the postman collection and the endpoints for each screen will be added as request routes in the folders

Request URL Structure

We maintain this request structure in the overall project:

host:port/dir/version/platform/model/operation

For instance:

Login url should be:

http://localhost:1048/api/v1/ {mobile or web}users/login

Response Structure

All response must follow this structure
status_code: the status code
message: human-readable message
data: response data
req: Request body when available

Response Code Rules

200 OK
Indicates that request has succeeded.

201 Created
Indicates that request has succeeded and a new resource has been created as a result.

400 Error
Indicates that the request has an error.

401 Unauthorized
Indicates that the request requires user authentication information. The client MAY repeat the request with a suitable Authorization header field

500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.

Folder setup

.env file
This contains all the environmental variables

mobile
All the controller files for each screens on the mobile are here

web
All the controller files for each screens on the web are here

models
All the model files are here

db
The database connection setup are configured here

routes
All the routes are setup here

utils
All the utility files are setup here, including the jwt etc

middleware
All the middleware functions alike auth, authorization, validation etc are setup here.

validations
All the validation files are here

Validations

Validation is done using Joi. Basic setup and implementation is done already, so you just implement the validation on the model you are working on.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store