7. Implementing HTTP Services in Node.js

One of the most important aspects of Node.js is the ability to implement HTTP and HTTPS servers and services very quickly. Node.js provides the http and https modules out of the box, and they give you a basic framework to do just about anything you might need to do from an HTTP and HTTPS standpoint. In fact, it is not difficult to implement a full webserver using just the http module.

However, the http module is pretty low level. You will likely use a different module, such as express, to implement a full-on webserver. The http module doesn’t provide calls to handle routing, cookies, caching, etc. In Chapters 18 and 19, you will see the advantages the express module provides.

What you will more likely be using the http module for is implementing backend web services for your applications to use. This is where the http module is an invaluable tool in your arsenal. You can create basic HTTP servers that provide an interface for communications behind your firewall and then create basic HTTP clients that interact with those services.

This chapter focuses on the objects you use when implementing clients and servers using the http module. The examples in this chapter are very basic so that they will be easy to consume and expand.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.191.150.2