Skip to content

iversonLv/todo-backend

Repository files navigation

Todo App MEN backend restful API

This is a todo app MEN backend(nodejs, express, mongodb) restful API.

The server is backend folder using nodejs, express, mongodb

api url is /api/v1/

Roles

  • If login as admin, will check the admin dashboard page (example: iversonLv_admin 123123123123)
  • If login as normal user, will check the user dashboard page (example: iversonLv 123123123123)
Roles Permissions
Admin View topOne, topTen todos related datas but not todo details, Delete user
User CURD its own todos, CRUD its own categories, UR its own profile

Config the env

Please check .env_sample for more detail

Keys Values Examples
TOKEN_SECRET jwt secret sdfwedfabcgefgwwdfdsfsdfscvsdsf
DB_URI Mongodb URI mongodb://127.0.0.1:27017/todos?retryWrites=true&w=majority
PORT API port 5000

How to run the app

  • Go to terminal, cd into the server folder
  • Run npm start
  • Or npm run dev for dev phase

How to generate test data

  • After installing dependencies npm i
  • Run npm run test-data to populate extra test data.
    It will generate some test users with their todos and categories

HTTP Code

Codes Purposes Examples
200 Ok, update, delete a resource
201 Create, signup
400 Bad request joi validate schema
401 Unauthorization No header authorization
403 Forbidden No admin roles
404 Not found No user, category, todo
409 Conflict username is taken

Git commit rule

  • Backend_MEN: xxxxxx
  • General: xxxxxx

Additional info

  • .nvmc is node version for the app
  • ./docs/todo-fullstack.postman_environment.json files for import to postman for the API environments
  • ./docs/todos.postman_collection.json files for import to postman for the API collections
  • swagger
  • backend database UML
  • trello for the project management
  • trello join link