Whether it is hypermedia or hypertext, the transmission protocol used is HTTP, which means that hypermedia can be accepted by all browsers. To describe the type of hypermedia we use MIME. MIME stands for Multipurpose Internet Mail Extensions, a multipurpose Internet mail extension type. MIME is an Internet standard. It was first applied to email systems. Later, its definition was gradually applied to the Internet field. Use MIME to specify the type of media, so the client browser can clearly know how to handle this type of media.
Node.js is a library built based on Google's V8 JavaScript engine. It is mainly used to build scalable network applications conveniently and quickly. Node.js is event-driven. It makes full use of JavaScript's closure characteristics and event processing mechanism, and adopts a non-blocking I/O model, which is very suitable for data-intensive real-time applications. Node.js implements similar functions to Apache HTTP Server, giving it the ability to build highly concurrent web applications based on JavaScript. Node.js enables front-end and back-end development to use the same programming language - JavaScript.
REST Web services can be said to be tailor-made for the HTTP protocol. In the HTTP protocol, URIs are used to identify unique network resources, and verbs such as GET, POST, PUT, and DELETE are used to operate resources. REST Web services are obviously better than SOAP Web services are more concise and efficient because they do not require additional encapsulation protocols and remote procedure calls.
As for the representation form of resources, it can be HTML5, XML data format, JSON data format, or binary Protobuf format. Which data format to use depends on the needs of the project.
Node.js provides HTTP manipulation capabilities, which can be used on the client or server. The biggest advantage of Node.js is that it has a large number of third-party libraries. In terms of RESTful Web Services, there are also multiple libraries that can simplify our development work. For example:
1) node-restify
Homepage: https://github.com/mcavage/node-restify
restify is a streamlined Node.js library similar to the Express library for building RESTful APIs.
Installation:
$ npm install restify
2) node-restful
Homepage: https://github.com/baugarten/node-restful
node-restful is a package of the Express library and is very suitable for creating RESTful APIs.
Installation:
npm install node-restful
There are many third-party libraries that I won’t list one by one. In addition, we can also directly use the core library of Node.js to build a RESTful API, or use the Express library to build a RESTful API. There are many ways to achieve the goal.
There are very few books on hypermedia, so there are even fewer books that specifically discuss how to build hypermedia APIs. Hypermedia is also a network resource, and it can also be defined by URI, so Node.js implements the RESTful API of hypermedia. is very easy.
I have to say that the translation of the book "Building Hypermedia API Using HTML5 and Node" is too stiff and makes it uncomfortable to read. However, this book itself is still very valuable, because the need to implement hypermedia RESTful API is very common and can be said to be one of the necessary skills for web developers. Read it over and over again to figure out its connotation. This is my little suggestion for readers of this book.