Skip to content

Serve non-blocking static HTML5. Includes CSS, a favicon and frontend JavaScript using plain Node. No Express framework.

License

Notifications You must be signed in to change notification settings

Wehzie/Node-mini-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node-mini-server without frameworks

The motivation for choosing an approach without framework was to develop an understanding for JavaScript and Node as they are. I was especially determined to avoid https://www.npmjs.com/package/express.

What does this server offer?

  • Semantic HTML, CSS.
  • Frontend JavaScript.
  • Favicon.
  • Asynchronous/non-blocking.
  • No frameworks.
  • Standalone server. (No Nginx or Apache needed)

What does this server not offer?

What improvements could be made?

What else to consider?

  • Although standalone Node is fully functional, Nginx or Apache in combination with Node bring some advantages.
    1. Nginx is faster than Node and Apache at serving static HTML.
    2. When Node crashes, having Nginx set up as remote proxy allows serving a custom error page.
    3. Nginx and Apache are better tested than Node as they are more frequently exposed to the internet.
  • Bundling frontend JavaScript you may want to use JavaScript modules in the browser (.mjs file ending, <script type="module">, import and export). For example see: https://developers.google.com/web/fundamentals/primers/modules

What about coding style?