Let’s dive in by defining the functionality and the structure we are going to have.

  • Ability to create, read, update, and delete tasks.
  • User profile with CRUD operations.
  • User authentication.
  • The user profile picture is always great for personalization, so we will also cover file uploading.
  • And we want our users to be safe, so we will encrypt user passwords in the database.
  • And we would like to run operations on tasks using their id, so we will cover that as well.

Let’s structure the app source -

  • Index.js — our index app file to run.
  • Routers — We will put our users and tasks functionality into different files to reduce the complexity of our API.
  • Models —Here we will define models to store data in the database in a good structure.
  • Middleware — Initially we only have one which is authentication, but this is a good structure for future use when we might want to add more.
  • Emails — We are going to use Sendgrid to send a few automated emails to our users on certain operations.
  • DB — And our database.
  • Other than the source files, we will have our default package and git ignore(if used) file.

#software-development #api #js #task-manager-app #nodejs

How to Make a Task Manager API with NodeJS
51.10 GEEK