Simple REST Service with Node.js and Express

Simple REST Service with Node.js and Express

Introduction

This is a simple tutorial showing how to create a REST service with Node.js using Express. This first tutorial will assume you have already installed Node.js, but it will walk you through installing Express and setting up a project. We will also show how to setup a simple REST service and how you can test it. In follow-up tutorials, we will show how to add a web page interface for interacting with the service, add authentication to the service and how to integrate with MongoDB for persistence.

If you are unfamiliar with Node.js, please visit their official website. Express is a web application framework for node.js, more info here.

The code for this tutorial is available here on github.

Setup The Environment

If you don’t already have express installed, you can install it with the following command: