Questions tagged [middleware]

Middleware is computer software that provides services to software applications beyond those available from the operating system. It can be described as "software glue".

Middleware is a software component (or components) that sits "in the middle" between applications and the operating system. Typically, middleware will facilitate application development by providing services such as communications, file access, or thread locking that have a common Application Programming Interface (API) across multiple operating systems.

Communications Middleware is a specific kind of middleware that allows for interprocess communications (on one machine or across a network). The purpose of Communications Middleware is to simplify the designing, programming, and managing of software applications by streamlining the way these applications receive and process data. Communications Middleware simplifies writing communications software while providing sophisticated built-in features, reducing development costs.

Examples of communications middleware include:

4333 questions
686
votes
13 answers

bodyParser is deprecated express 4

I am using express 4.0 and I'm aware that body parser has been taken out of the express core, I am using the recommended replacement, however I am getting body-parser deprecated bodyParser: use individual json/urlencoded middlewares…
Melbourne2991
  • 11,707
  • 12
  • 44
  • 82
655
votes
9 answers

What is Node.js' Connect, Express and "middleware"?

Despite knowing JavaScript quite well, I'm confused what exactly these three projects in Node.js ecosystem do. Is it something like Rails' Rack? Can someone please explain?
tillda
  • 18,150
  • 16
  • 51
  • 70
316
votes
8 answers

Passing variables to the next middleware using next() in Express.js

I want to pass some variable from the first middleware to another middleware, and I tried doing this, but there was "req.somevariable is a given as 'undefined'". //app.js .. app.get('/someurl/', middleware1,…
user2791897
  • 3,179
  • 2
  • 12
  • 7
306
votes
4 answers

Node.js / Express.js - How does app.router work?

Before I ask about app.router I think I should explain at least what I think happens when working with middleware. To use middleware, the function to use is app.use(). When the middleware is being executed, it will either call the next middleware by…
Aust
  • 11,552
  • 13
  • 44
  • 74
240
votes
16 answers

What is middleware exactly?

I have heard a lot of people talking recently about middleware, but what is the exact definition of middleware? When I look into middleware, I find a lot of information and some definitions, but while reading these information and definitions, it…
Michel
  • 9,220
  • 13
  • 44
  • 59
214
votes
12 answers

How can I enable CORS on Django REST Framework

How can I enable CORS on my Django REST Framework? the reference doesn't help much, it says that I can do by a middleware, but how can I do that?
Julio Marins
  • 10,039
  • 8
  • 48
  • 54
139
votes
2 answers

req.locals vs. res.locals vs. res.data vs. req.data vs. app.locals in Express middleware

There are some similar questions asked but my question is that if I want to propagate intermediate results that I get along the different routing middleware, what is the best way to do that? app.use(f1); app.use(f2); app.use(f3); function…
Sunny
  • 9,245
  • 10
  • 49
  • 79
114
votes
8 answers

Use specific middleware in Express for all paths except a specific one

I am using the Express framework in node.js with some middleware functions: var app = express.createServer(options); app.use(User.checkUser); I can use the .use function with an additional parameter to use this middleware only on specific…
Thomas
  • 10,289
  • 13
  • 39
  • 55
104
votes
12 answers

message driven vs. event driven approaches to application integration

I was wondering if there is a clear distinction between message driven and event driven environments when we refer to SOA or middleware and generally in cases of application and enterprise integration. I understand that a user interface resembles an…
denchr
  • 4,142
  • 13
  • 48
  • 51
101
votes
3 answers

Chaining multiple pieces of middleware for specific route in ExpressJS

I want to just verify something but have't been able to find anything in the Express docs or online regarding this (although I know it's a feature). I could just test this out but I don't really have a nice template and would like to hear from the…
Anthony
  • 13,434
  • 14
  • 60
  • 80
77
votes
7 answers

How to add multiple middleware to Redux?

I have one piece of middleware already plugged in, redux-thunk, and I'd like to add another, redux-logger. How do I configure it so my app uses both pieces of middleware? I tried passing in an array of [ReduxThunk, logger] but that didn't…
doctopus
  • 5,349
  • 8
  • 53
  • 105
59
votes
5 answers

Node Express 4 middleware after routes

Following the upgrade to Express 4, and the removal of app.router, I'm struggling to get middleware to execute after routes execute. e.g. the following code correctly responds with "hello", but never calls the configured middleware var express =…
goofballLogic
  • 37,883
  • 8
  • 44
  • 62
57
votes
8 answers

ASP.NET MVC 6 AspNet.Session Errors - Unable to resolve service for type?

Alright, so recently I've been having a lot of trouble using the new Microsoft.AspNet.Session middleware for ASP.NET vNext (MVC 6). The error I'm getting, Unable to resolve service for…
PlsBroSendHelp
  • 583
  • 1
  • 4
  • 6
51
votes
9 answers

Non-global middleware in Django

In Django there is a settings file that defines the middleware to be run on each request. This middleware setting is global. Is there a way to specify a set of middleware on a per-view basis? I want to have specific urls use a set of middleware…
hekevintran
  • 22,822
  • 32
  • 111
  • 180
51
votes
2 answers

What is the difference between 'session' and 'cookieSession' middleware in Connect/Express?

There are two session-related middleware packages bundled with Connect/Express. What is the difference? How do I choose? I'm assuming that session middleware is the same as cookieSession middleware - but with an extra store mechanism.
gfaceless
  • 1,529
  • 1
  • 17
  • 22
1
2 3
99 100