O'Reilly logo

Node.js Blueprints by Krasimir Tsonev

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Developing an online library – a REST API

The development of a REST API is the same as the development of every other Node.js application. We need to plan it and carefully implement the different components one by one.

Defining the API parts

It's always good to have a plan before starting a new project. So, let's define the main parts of the API server as follows:

  • Router: We know that Node.js starts listening on a port and accepts an HTTP requests. So, we need a class that will handle them and pass the request to the right logic.
  • Handler: This is the place where our logic will be put in. It will process the request and prepare the response.
  • Responder: We also need a class that will send the result to the browser. Very often the API has to respond in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required