An example of a vanilla node server with both http & https
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
https
utils
.gitignore
README.md
index.js

README.md

Vanilla Node Server

Bootstrap for a vanilla node.js server without Express so you can see how it works.

What this Repo Has to Offer

Too many tutorials out there for Express, Hapi, etc, it's always better to learn the fundamentals of Node.js which is often overlooked by developers as they continue to npm, npm away.

  • Everything in one file without modularization
  • Vanilla Node Server with http and https support
  • Standard err/callback pattern, no promises or async, await
  • As vanilla JS as possible, only ES6 syntax for arrow functions and template literals
  • Support for http & https
  • Config for NODE_ENV supporting dev, prod, staging
  • Basic Routing & Handling
  • Returns a response with empty object if no payload
  • No package.json :)

Start Server

  • Start node index.js
  • Start with NODE_ENV: NODE_ENV=production node index.js
  • Check to see if server is running:
     NODE_ENV=staging node index.js
     POSTMAN > localhost:3000/status
  • Stop Server: Ctrl + C