Getting Started With Building Todo App Backend

Getting Started With Building Todo App Backend

In this section, we will build the famous Todo application with Node.Js using the Express Js Framework and MongoDB as a NoSQL database. The app will be API-centric with no Frontend UI.

In a nutshell, if you want to learn how to build APIs with Node.Js, you have come to the right place.

What you will need to install

  • You will need Node v10.0.0+
  • You will need to install PostMan

What you need to Know

If you are new to the Nodejs world you can follow up the below Tutorials to get more from this tutorial series, and if you have basic knowledge of Nodejs, Express JS and Mongoose then you can skip this.

NodeJs tutorial for beginners

Learn Express Framework by building an application.

Learn how to use Mongoose with Nodejs and Express

Now you can grab a mug of coffee and let's get our hands dirty.

Lets understand some Terms:

What is ExpressJs?

ExpressJs simply put, it's a web framework for Node.Js - stolen from the official docs. Taylor Otwell (Laravel's creator) once said, "Developers build tools for developers". ExpressJs was built for developers to simplify Node APIs.

What is MongoDB?

MongoDB is a NoSQL database. It's completely document-oriented. A NoSQL database allows you to store data in the form of JSON and any formats. If you want to learn more about MongoDB, visit the official documentation here

Now Let's start by defining our API routes.

Defining Todo APIs Routes

I like to begin by defining my APIs. As it is very important for a developer to first think of how the API endpoints are going to look like and what they do, also they should be easy to remember and easy to use. The table below shows what APIs we need to create and what each does.

MethodPathDescription
GET/todosGet all todos items
GET/todos/:idGet one todo item
POST/todosCreate a new todo item
PUT/todos/:idUpdate a todo item
DELETE/todos/:idDelete a new todo item

Having defined our APIs, let's delve into setting up the Express App and the project directories.

If you are a person who understands concepts better through videos, then you can Watch My Hands-On Workshop on Building A TODO REST API BAckend which we are discussing in this tutorial series.