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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.