On the role of node in constructing Hypermedia API _node.js

Source: Internet
Author: User
Tags install node npm install node advantage

Whether it is hypermedia or hypertext, the transport protocol used is HTTP, which means that hypermedia can be accepted by all browsers. We use MIME to describe the type of hypermedia. MIME is Multipurpose Internet Mail Extensions, Multipurpose Internet Mail Extension type, MIME is an Internet standard, it was first applied to e-mail system, and its definition was gradually applied to the Internet domain. By using MIME to specify the type of media, the client browser can clearly know how to handle this type of media.

Node.js is a library based on Google V8 JavaScript engine, which is mainly used for easy and fast building of scalable network applications. Node.js is event-driven, it takes full advantage of JavaScript's closure characteristics and event handling mechanism, and uses non-blocking I/O model, which is very suitable for data-intensive real-time applications. Node.js features similar to Apache HTTP server, making it capable of building high concurrent Web applications based on JavaScript. Node.js enables the use of the same programming language--javascript for both front and back end development.

Rest Web services can be said to be tailored for HTTP protocols, using URIs in the HTTP protocol to identify unique network resources, and using verbs such as GET, POST, put, and delete to manipulate resources, rest Web services are clearly more concise and efficient than SOAP Web services, Because it does not require additional encapsulation protocols and remote procedure calls.

As for the representation of the resource, it can be HTML5, or it can be an XML data format, JSON data format, or binary protobuf format. Which data format to use depends on the requirements of the project.

Node.js provides HTTP manipulation capabilities that can be used on either the client or server side. Node.js's biggest advantage is that it has a large third-party library, and in RESTful Web services, there are also multiple libraries that can simplify our development efforts. Like what:

1) node-restify

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

Restify is a streamlined, similar to express Library, used to build the RESTful API Node.js library.

Installation:

$ NPM Install Restify

2) node-restful

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

Node-restful is the encapsulation of the Express library and is ideal for creating restful APIs.

Installation:

NPM Install Node-restful

There are many third party libraries that are not listed. In addition, we can build the RESTful API directly using Node.js's core library, or use the Express library to build the RESTful API. There are many ways to achieve the goal.

There are few hypermedia books, so there are fewer books devoted to how to build Hypermedia APIs, and Hypermedia is also a network resource, and the same can be defined with URIs, so it is easy to node.js the RESTful API for hypermedia.

Have to say, "Use HTML5 and node to build hypermedia API" This book translation is too blunt, read the feeling is not carefree. However, the book itself is valuable because the need to implement Hypermedia restful APIs is common and is one of the essential skills of web developers. Reading it over and over again is a little advice to readers of this book.

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.