I want to use one of the ExpressJS middleware in SailsJS application. Its the "express-limiter" module(which is a express middleware) for rate limiting an api using IP address. Normally in express we do:
app.use(limiter({ some parameters }))
How to I use this middleware or any other express middleware in SailsJS application? Appreciate your help.
install the middleware npm install --save express-limiter
change the config/http.js
file adding the express-limiter
middleware: {
order: [
'express-limiter-key'
],
'express-limiter-key' = require('express-limiter')
}
the
var limiter = require('limiter')
won't work since >middleware.order
is simply a lookup, and will search only keywords inmiddleware
object.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With