Defining the API routes

One of the most important aspects of our API are routes that we take to create, read, update, and delete our speakers.

Our routes are based on the HTTP verb used to access our API, as shown in the following examples:

  • To create record, use the POST verb
  • To read record, use the GET verb
  • To update record, use the PUT verb
  • To delete records, use the DELETE verb

So, our routes will be as follows:

Routes

Verb and Action

/api/speakers

GET retrieves speaker's records

/api/speakers/

POST inserts speakers' record

/api/speakers/:speaker_id

GET retrieves a single record

/api/speakers/:speaker_id

PUT updates a single record

/api/speakers/:speaker_id

DELETE deletes a single record

Configuring the API routes:

  1. Let's start ...

Get Learning Single-page Web Application Development 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.