List of Node.JS web frameworks

Interesting list of Node.JS web frameworks

The marketing of https://www.fastify.io/ is getting to me.
But I suppose one should stick to Express since it is the most widely used.

Does anyone have any preferences/experiences with these frameworks?

Express will probably be easier, but the concepts are similar, so if you know how Express works, Fastify should make sense.

If you break their Fastify example into two lines, it looks like this:

// import the library
const fastifyLib = require('fastify');

// create the app
const fastify = fastifyLib({ logger: true })

which is basically the same thing as this in Express:

// import the library
const express = require("express");

// create the app
const app = express();

To define a route in Fastify, you write:

// create a home page route and its function
fastify.get("/", async (request, reply) => {
    return { hello: "world" };
});

In Express, it’s nearly the same:

// create a home page route and its function
app.get("/", (request, response) => {
    response.json({ hello: "world" });
});

Almost every web framework does the same thing. Here’s the same code in Flask (a Python framework):

# import the libraries
from flask import Flask, jsonify

# create the app
app == Flask(__name__)

# define a route and its function
app.route("/")
def home_page():
    return jsonify({ "hello": "world" })
1 Like