
5 most lightweight and eco-friendly node js framework http-servers
When spinning up a website you need an HTTP webserver to serve your pages when someone sends a request in the browser, but which HTTP server should you choose for your Node JS web application, and should it be lightweight?
In this article, we will try to answer that question by explaining what an HTTP server is, why you should choose a lightweight server, and then by the end give you a list of the 5 best lightweight node JS HTTP servers.
What a Node JS HTTP web server is
In short: An HTTP server is created for the web and it awaits requests from the browser that it can translate into actions that might be displaying pages or sending data.
When you are pushing a website to the hosting company you don’t necessarily need an HTTP server or reverse proxy to serve the static content on your website. You could for example use routes such as /index.html which will then display the index.html file. This approach is how things were done back in the days, but today we use what we call an HTTP server to handle these requests for us.
When you on a website go to "/", there is an HTTP web server behind it checking that when you ask to see "/" then it should return the index page.
It works the same way for routes such as "/blog", but here the server will ask the database for all the blogposts before sending you the blog page. So basically an HTTP server allows us to do additional tasks at the same time we display an HTML page, such as getting blogposts or logging visits. If we weren’t using an HTTP server it would be harder to interact with the database and run functions behind the scenes.
Here is a more in-depth going article about how HTTP web servers work
Why choose a lightweight and more eco-friendly Node JS HTTP server?
It is no secret that the internet is polluting every time we interact with it, but what you probably didn’t know is that if the internet was a country it would be the 6th biggest polluter in the world. Data centers are using tons of electricity to keep their servers running, access points between you and the webserver are using power and your device is using power. As you can imagine, it is enormous amounts of electricity that are being used to give everyone access to the internet and to keep the over 1 billion websites running.
Because the internet is such a polluter we must choose to use sustainable web design and make use of lightweight HTTP servers. Lightweight HTTP servers will use significantly less power compared to a bloated and fully featured HTTP server.
The five most lightweight Node JS HTTP web servers
To make it easier for you to decide which Node JS HTTP Framework Web Server you should go it, we've made a list underneath. The list contains five lightweight HTTP servers which are easy to get started with and easy to use.
#1 Koa JS
Koa JS is a relatively new framework made by the creators of Express and it aims to be even more lightweight than its big brother. It also has modern JavaScript built in to make it easier for you to use functions like async-await. Koa comes as a lightweight HTTP server but if you need more functionalities you can install and attach them as you see fit.
Here is an example of how to create a simple lightweight Koa JS HTTP web server:
const Koa = require('koa'); const app = new Koa(); app.use(async ctx => { ctx.body = 'Hello World'; }); app.listen(3000);
#2 Express JS
Express JS has been around for many years now and over time it has evolved from a simple HTTP server to become more complex. Express is easy to get started with and it comes out of the box with lots of useful features which will make programming faster and easier for you. Sadly Express has been halting a bit the past years and therefore it still doesn’t support HTTP/2 out of the box, but implementations have been made which you can use.
Here is an example of how to create a simple lightweight Express HTTP web server using Express JS:
const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`) })
#3 Meteor JS
Meteor JS is the all-in-one framework that you can use to build web applications and mobile applications. With Meteor you can use JavaScript both in the front end and in the back and it allows you to make use of HTML and CSS as well. If you don’t want to look for lots of puzzle pieces and put them together then you can do something like IKEA and use Meteor instead.
#4 Feather JS
Feather JS is as the name says, lightweight and a framework for real-time web applications and REST API. With Feather JS you can write your HTTP server in JavaScript or TypeScript and it supports React, Vue JS, Angular, React Native, Android, and iOS in the front end. In other words: Feather JS can be used together with many front-end and back-end frameworks and databases.
#5 Diet JS
Diet JS is a fast, tiny and modular Node JS framework that makes it easy and fast for you to build HTTP web servers and REST API. You can use JavaScript while building the backend and getting started only takes a few lines of code.
Below You will find an example of how to create a simple lightweight HTTP web server responding with text:
var server = require('diet') var app = server() app.listen('http://localhost:8000') app.get('/', function($){ $.end('Hello World!') })
Author
Michael Andersen
Michael Andersen is the author of Sustainable Web Design In 20 Lessons and the founder of Sustainable WWW (World-wide-web), an organization teaching sustainable practices. With a passion for web design and the environment, Michael solves puzzles to make the internet more sustainable.

Michael Andersen
Michael Andersen is the author of Sustainable Web Design In 20 Lessons and the founder of Sustainable WWW (World-wide-web), an organization teaching sustainable practices. With a passion for web design and the environment, Michael solves puzzles to make the internet more sustainable.