vjjj
vjjj

Reputation: 1069

fastify.js equivalent of express next() for Node server

In express, we have routes like so :-

app.get("/route1", function(req, res, next){
...
}

What would be the equivalent statement in Fastify Framework (next part is important)?

Upvotes: 2

Views: 3762

Answers (1)

Manuel Spigolon
Manuel Spigolon

Reputation: 12890

The equivalent would be:

app.get('/route1', function(request, reply) {
...
}

Where request and reply are the Fastify custom object.

There is NOT next since there is no a chain of middleware in Fastify, but there is the concept of Lifecycle of a request that you can customize with hooks

Upvotes: 2

Related Questions