Express

In notebook:
FrontEndMasters API design
Created at:
2016-03-13
Updated:
2016-03-13
Tags:
backend JavaScript libraries Express

Servers

Node has http module built-in. It's a huge object. To create a http server on a TCP connection.
There are some limitations. Lots of configuration and setup, very difficult. If you don't know about networking, you can get memory leaks, etc.

Express, Sails, Hapi, Koa abstract this out.

Express by far the most popular and simplest one. Maybe not the easiest one. It uses the http module.
Still configuration necessary. It's not like Rails. To generate everything. There are frameworks that sit on top Express to abstract out the configuration.
  • http module
  • static assets
  • request routing
- Express vs Restify?
- For a REST api he would choose Restify over Express 3 and Express 4 over Restify
Express 4 has subrouters. If you have to serve static assets, website then Express.
If you're building a Rest API for a mobile app, Restify is better.
Not sure how well Restify is maintained. Express is very well maintained.
Restify is great for API design.
Sails is closest to Rails

- Loopback vs Express
- Loopbakc is maintainer of Express. Loopback sits on top of Express. You have less setup. Start with Express then if you know well, you can move to Loopback and it's conventions.
Express is more configurable. Loopback is more conventions.

Express

Takes advantage of NodeJS evented IO. 
Register callbacks that get executed when a particular combination of http verbs and routes are hit. you set the order these callbacks will run.

Lack of strict conventions.