Learning Express: Part 4: RESTful Design

Learning Express

Express is a popular minimalist web framework for Node.js.

RESTful Design

Representational State Transfer (REST) is a software architectural style using uniform URI resources with stateless operations. It maps common CRUD tasks as HTTP request methods.

CRUDHTTP Request Method

Creating a RESTful design is based on determining core objects and their relationships. For a project based on organizing books, for example, a URI component might be “/book/:id” to return a single resource or “/genre/:topic” to return a collection of books based on their genre.

Resource manipulation through representations

Designs following the RESTful style should allows all valid CRUD operations for existing resources via the representation provided. In other words, having a representation, a URI scheme, should allow all valid operations within the permission context.

The use of the words “permission context” are important because it could be the case that clients have limited or varying permissions. Not all clients may be allowed to delete or change recourses, for example.

Self-descriptive messages

An important consideration when using RESTful design is to also include “self-descriptive messages” for all end-routes. Any parameter passed to a URL should return some form of feedback, even if only an error message.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.