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
1
vote
0 answers

Rails Middleware in console?

I want to run some code around a rails console session (e.g. add log tagging, set database connection). For the rails server I can do this using middle ware, but can this also be done for the console? see also: Rails7 MultiDB switch shard for…
Notalifeform
  • 194
  • 1
  • 8
1
vote
1 answer

Azure function middleware - Get response data before return to user

I want to retrieve data and format it before return to the user but don't know how to retrieve it, I see that the context only provides the request. public class CustomResponse : IFunctionsWorkerMiddleware { public async Task…
Jihai
  • 110
  • 8
1
vote
1 answer

What is the best way to make a request from a node express app to a third party api that requires its own authentication?

I have a node express app that uses keycloak authentication to secure all API endpoints. Express middleware has been set up for authentication to make sure that each incoming request from the front end has the appropriate keycloak token. I need to…
Oamar Kanji
  • 1,824
  • 6
  • 24
  • 39
1
vote
1 answer

How to add Middleware-based support for WebSockets to .net core server?

I'm working on a .net core project which currently offers a REST API and I would like to add websocket functionality to this server. According to this developer page by microsoft it should be possible to do the following: public class…
Martin Häusler
  • 6,544
  • 8
  • 39
  • 66
1
vote
1 answer

Nuxt 3 `addServerMiddleware` only works in development, not in production

Since @nuxt/proxy is not yet ready for Nuxt 3, I stole the code and used my own module temporarily. Unfortunately, the proxy only seems to work when in development mode. As soon as I build and run the server, the proxy is disabled. Broken down to…
Aram Becker
  • 2,026
  • 1
  • 20
  • 32
1
vote
1 answer

Middleware is being called multiple times for one path

I have a rate limiter for requests and using it as a middleware for every mux handler in my project. The problem occurs when middleware is called 4 times when going to a page with path of /post. Every other page seems to work as expected - calls the…
1
vote
1 answer

Using Fastify preHandler middleware

Passing a middleware to authenticate user before accessing this route. When I'm passing tokenController.authUser as a middleware tokenService inside tokenController is undefined. However when I run this method as a function inside the route instead…
Rohan
  • 57
  • 3
  • 10
1
vote
1 answer

Middleware works on localhost but not on apache2 VM server

pretty much the title sums it up. I have a laravel application which I develop on my laptop & also test when it is running on 127.0.0.1/8000 - I just added middleware for different users (Admin, Employee & Portal user) When not logged in and trying…
Frevelman
  • 338
  • 3
  • 11
1
vote
0 answers

How do I use API middlewares to protect API routes from unauthenticated users in Next.js?

I have a next.js app that has several API routes that I am hoping to protect from users who are not logged in. Using next-auth, I understand that I can add the following code to each API route to achieve this. import { getSession } from…
Alex
  • 11
  • 2
1
vote
0 answers

socket.io - middleware vs running after connection

I'm working with socket.io for the first time to setup auth. Whats the difference between using a middleware vs running a function after connection? Ref: https://socket.io/docs/v4/middlewares/ // middleware io.use((s, next) => { if…
SILENT
  • 3,916
  • 3
  • 38
  • 57
1
vote
0 answers

Rack Middleware execution railscast

To understand Rack, I was following Railscast video on Rack Middleware and trying out the same thing in my machine. But I'm facing few issues and unable to solve. Firstly, the Rails::Initializer.run is not in my Rails App (I'm using Rails 6), so i…
Learn-ing
  • 21
  • 2
1
vote
1 answer

Invoking a method on SignalR connection in Redux middleware to send message to server

I'm using middleware in Redux to connect to my signalR hub, which works perfectly and I can receive messages no problem. Now I have got to the point where I want to invoke a method on the server to "Join a Group". What is the best way to do so? I…
Alex Driver
  • 125
  • 7
1
vote
1 answer

Express sessions not persisting after redirect in node.js

Using node.js and pgAdmin. I have set up all the necessary code for a server, sessions, cookies, and all that. The error I'm getting is "TypeError: Cannot read property 'username' of undefined". The session will not persist after it redirects from…
Link
  • 35
  • 7
1
vote
0 answers

How to convert/replace Express Middleware logic for Azure?

Migrating our existing Nodes API backend to Azure serverless Functions, we have custom Express middleware implementation, for example typical router-middleware-controller Router: const mdw = require("../middleware/mdw"); module.exports = app => { …
Jeb50
  • 6,272
  • 6
  • 49
  • 87
1
vote
1 answer

How to exclude specific route from middleware in go-chi

I've been using go-chi for a project and using an auth middleware for routes like this r := chi.NewRouter() r.Use(authService.AuthMiddleware) r.Route("/platform", func(r chi.Router) { r.Get("/version", RequestPlatformVersion) }) This is…
Thidasa Pankaja
  • 930
  • 8
  • 25
  • 44