• nodejs can handle more than 1M concurrent connections in a 16GB server study and over 600k websocket connections.

Best Practices

Graceful shutdown for your applications

When you deploy a new version of your application, the old must be replaced. The process manager you are using (no matter if it is Heroku, Kubernetes, supervisor or anything else) will first send a SIGTERM signal to the application to let it know, that it is going to be killed.

Once it gets this signal, it should:

  • stop accepting new requests
  • finish all the ongoing requests
  • and clean up database connections or file locks.

terminus is an npm package to help gracefully shutdown nodeJS apps.


Website indicators


     * GZip helper
     * To use this, the build has to compress the bundles into gzip.
     * @return {undefined}
    sendGzip (req, res) {

        let filePath = path.resolve(`public/${req.path}`);

        if (/css/.test(filePath)) {
            res.setHeader('Content-Type', 'text/css');

        if (!fs.existsSync(filePath)) {
            res.setHeader('Content-Encoding', 'gzip');
            filePath += '.gz';


// or use `npm compression`
import compress from 'compression';
  • vim: associate .hbs file extension with HTML by adding the line au BufNewFile, BufRead *.hbs set file type=html to your .vimrc file

Page tests


  • HTTP ports use 1023+ (pg 54)
  • HTTP queryStrings must be URL encoded (eg. using encodeURIComponent
  • URL hash (fragment) # is only in the browser (eg. `id='chapter-03')


  • ink CLI tools with React
  • zeit pkg - binary nodejs apps

results matching ""

    No results matching ""