Chapter 4

RESTful APIs with Node.js

Learning Objectives

By the end of this chapter, you will be able to:

  • Set up the project structure for an Express.js API
  • Design an API with endpoints using different HTTP methods
  • Run the API on the localhost and interact with it via cURL or a GUI-based tool
  • Parse user inputs for endpoints and consider different ways of dealing with errors
  • Set up an endpoint that requires user authentication

In this chapter, we will use Express.js and Node.js to set up an API that can be used by frontend applications.

Introduction

Application Program Interfaces (APIs) have become more important than ever. The use of an API allows for a single server-side program to be used by multiple scripts and applications. Due to ...

Get Professional JavaScript now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.