Skip to Main Content
Mastering TypeScript 3 - Third Edition
book

Mastering TypeScript 3 - Third Edition

by Nathan Rozentals
February 2019
Beginner content levelBeginner
694 pages
18h 4m
English
Packt Publishing
Content preview from Mastering TypeScript 3 - Third Edition

Parameterized API endpoints

When designing REST endpoints, the general rule of thumb is to provide an endpoint for each of the logical groups of data that will be queried. The name of this endpoint should be a plural, indicating that it will return an array of results. So the /api/boards endpoint will return a list of data relating to all the boards within the database. Search criteria can then be implemented on this endpoint to filter results. As an example, the /api/boards?type=1&manufacturer=2 URL should apply the type and manufacturer values as a filter in order to limit the search of all boards in the system.

When we need to work with a single instance of an item, we append the id of the item we wish to query to the plural endpoint name. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The TypeScript Workshop

The TypeScript Workshop

Ben Grynhaus, Jordan Hudgens, Rayon Hunte, Matt Morgan, Wekoslav Stefanovski

Publisher Resources

ISBN: 9781789536706Supplemental Content