polka is the lightest Node HTTP server package.
Highly unscientific but nevertheless worth writing down. Lightest here refers to the eventual weight added to the
node_modules directory which is a reflection of network and disk use.
When you write a serious web server in Node you probably don't care about which one is lightest. It's probably more important which ones are actively maintained, reliable, well documented, and generally "more familiar". However, I was interested in setting up a little Node HTTP server for the benefit of wrapping some HTTP endpoints for an integration test suite.
In a fresh new directory, right after having run:
yarn init -y run the
yarn add ... and see how big the
node_modules directory becomes afterward (
du -sh node_modules).
polka is the lightest. But I'm not so sure it matters. But it could if this has to be installed a lot. For example, in CI where you run that
yarn install a lot. Then it might save quite a bit of electricity for the planet.