Analysis on the role of Node in the Construction of hypermedia APIs _ node. js-js tutorial

Source: Internet
Author: User
Tags install node npm install node
Hypermedia is a technology that uses a non-linear mesh structure to organize and manage massive multimedia information (including text, images, and videos. The concept of hypermedia is similar to that of hypertext in the early days. The essence of hyper-media is to add links to the text content, which constitutes hyper-text. The same is true for hypermedia. Both hypermedia and hypertext are transmitted over HTTP, which means that hypermedia can be accepted by all browsers. MIME is used to describe the type of hypermedia. MIME is the Multipurpose Internet Mail Extensions, a multi-purpose Internet Mail Extension Type. MIME is an Internet standard and was first applied to the email system. Its definition is gradually applied to the Internet field. If MIME is used to specify the media type, the client browser can clearly understand how to deal with this type of media.

Node. js is a library built based on Google V8 JavaScript engine. It is mainly used to conveniently and quickly build scalable network applications. Node. js is event-driven. It makes full use of the closure feature and event processing mechanism of JavaScript and adopts a non-blocking I/O model, which is very suitable for real-time data-intensive applications. Node. js implements functions similar to Apache HTTP Server, enabling it to build JavaScript-based highly concurrent Web applications. Node. js allows frontend and backend development to use JavaScript, the same programming language.

REST Web services can be customized for the HTTP protocol. In the HTTP protocol, Uris are used to identify unique network resources and GET, POST, PUT, DELETE, and other verbs are used to operate resources, the REST Web Service is obviously more concise and efficient than the SOAP Web service because it does not require additional encapsulation protocols and remote process calls.

The resource format can be HTML5, XML, JSON, or binary Protobuf. Which data format is used depends on the project requirements.

Node. js provides HTTP manipulation capabilities that can be used on clients or servers. The biggest advantage of Node. js is that it has a large third-party library. In the aspect of RESTful Web Services, multiple libraries can simplify our development work. For example:

1) node-restify

Home: https://github.com/mcavage/node-restify

Restify is a streamlined and similar to the Express library. It is used to build the Node. js library of RESTful APIs.

Installation:

$ npm install restify

2) node-restful

Home: https://github.com/baugarten/node-restful

Node-restful is the encapsulation of Express libraries and is suitable for creating RESTful APIs.

Installation:

npm install node-restful

Many third-party libraries are not listed one by one. In addition, we can 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 methods to achieve the goal.

There are very few hypermedia books. Therefore, there are fewer books dedicated to the Construction of hypermedia APIs. hypermedia is also a network resource and can also be defined using Uris. Therefore, Node. js to implement the RESTful API of hypermedia is very easy.

I have to say that the book "using HTML5 and Node to build a hypermedia API" is too hard to translate, and it is not easy to read. However, this book is still very valuable, because the demand for implementing the RESTful API of supermedia is very common and can be said to be one of the essential skills of Web developers. Reading it over and over again and trying to figure out its meaning is a little bit of advice for readers of this book.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.