This is a fundamental User/Task Server using REST API measures.
- Create User
- Delete User
- Sub - Action can be done only to logged and authorized user's data.
- Deleting user triggers another action to remove all tasks created and assigned to the deleted user.
- Signup a New User
- Read User
- Gathers data only when authorized user logged in.
- Action can be done only to logged and authorized user's data.
- Gathers only non-private data (hides password, user avatar and tokens)
- Patch User Info
- Updates only logged users' data.
- Upload User Avatar
- Fetch user avatar
- Action can be done only to logged and authorized user's data.
- Delete user avatar
- Action can be done only to logged and authorized user's data.
- Create Task
- Action can be done only to logged and authorized user's task data.
- Read Task
- Action can be done only to logged and authorized user's task data.
- Delete Task
- Action can be done only to logged and authorized user's task data.
- Patch Task
- Action can be done only to logged and authorized user's task data.
- Fetch all Tasks.
- Action can be done only to logged and authorized user's task data.
There's a simple middleware uses jwt(a npm tool) to create and verify tokens of users which helps to recognize if whom communicates with the server is a logged in user..
-
This json file should be imported to your postman dashboard as collection. Expect a result as seen in the screenshot below.
-
Environment variables should be configured as seen in the screenshot below.
-
To make requests work which imported in the first step, you should assign the configured environment to each of them as seen in the screenshot below.
- run the
npm install
command. - Create a directory named
config
in the root directory - Create files named
test.env
anddev.env
- Configure
.env
files as seen below
MongoDB should be installed in your computer.
- Start MongoDB to your designated data path (Do this to save your database to a known directory)
- To start once -> Run command
npm run start
- To start again whenever a change in filesystem has been detected -> Run command
npm run dev
- To run unit test -> Run command
npm run test
- Your server is up !
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.