Web application frameworks

The HTTPServer object is very close to the HTTP protocol. While this is powerful in the same way that driving a stick shift car gives you low-level control over a car, typical web application programming is better done at a higher level. It's better to abstract away the HTTP details and concentrate on your application.

The Node.js developer community has developed quite a few modules to help with different aspects of abstracting away HTTP protocol details. You can take a look at a couple of curated lists at http://nodeframework.com/ and https://github.com/vndmtrx/awesome-nodejs.

One reason to use a web framework is that they often provide all the usual best practices that have come from web application development of over 20 years. They have been listed as follows:

  • Providing a page for bad URLs (the 404 page)
  • Screening URLs and forms for any injected scripting attacks
  • Supporting the use of cookies to maintain sessions
  • Logging requests for both usage tracking and debugging
  • Authentication
  • Handling static files, such as images, CSS, JavaScript, or HTML
  • Providing cache control headers to caching proxies
  • Limiting things such as page size or execution time

Web frameworks help you invest your time in the task without getting lost in the details of implementing HTTP protocol. Abstracting away details is a time-honored way for programmers to be more efficient. This is especially true when using a library or framework providing prepackaged functions that take care of the details.

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

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