Building a RESTful API to manage users with ExpressJS and Mongoose
In this recipe, you will build a RESTful API that will allow the creation of new users, log in, display user information, and delete a user's profile. Furthermore, you will learn how to build a NodeJS REPL with a client API that you can use to interact with your server's RESTful API.
A REPL (Read-Eval-Print Loop) is like an interactive shell where you can execute commands one after another. For instance, the Node.js REPL can be opened by running this command in your terminal:
node -i
Here, the -i
flag stands for interactive. Now, you can execute the JavaScript code that gets evaluated piece by piece in a new context.
Getting ready
This recipe will be focused on showing the integration of Mongoose with ExpressJS using what was seen in previous recipes. First, ensure that you have MongoDB installed and it's running. As an alternative, if you prefer, a MongoDB DBaaS instance in the cloud will also do. Before you start, create a new...