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
1 answer

How to rethrow Fluent Validation exception

How to run ErrorHandlingMiddleware after FluentValidation? services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Latest) .AddJsonOptions(options => { …
user8753842
1
vote
1 answer

Middleware next() routeHandler

I am currently reading this article http://qnimate.com/express-js-middleware-tutorial/#prettyPhoto At the section Middleware the author is explaining very well what the benefit of next() is. Writing this var app = require("express")(); function…
Aalexander
  • 4,987
  • 3
  • 11
  • 34
1
vote
0 answers

Reusing Request Body/Data in werkzeug/flask

I want to access the request body in a flask middleware but problem is once the stream is read im unsure how to get it back for the rest of the service in my middleware i want to do something along the lines of data =…
mshlis
  • 172
  • 6
1
vote
0 answers

Why is my express Router middleware executing multiple times?

Its my first foray into building a REST api with node/express and I have different routes based on resource type (e.g. users, auth, feed). im using express-validator in all the routes, and some of the users routes need to be protected with some…
MT Dev
  • 51
  • 1
  • 2
1
vote
1 answer

Routes going through api.php returning unauthorised whereas the same route going through web.php works

I have a page which enables users to create 'folders'. I'm using the function below to getAll folders belonging to each user, so when a user logs in they should see all of their folders but not the folders of other users. /** * Retrieve all user…
One_for_all
  • 299
  • 1
  • 13
1
vote
0 answers

Swagger Response Examples .Net 5 are not displayed

After updating my .net core 2.1 project to .net-5 and swagger swashbuckle from 2 to 5.6.3 the swagger response examples are not getting displayed anymore. Is there a new best practice way on how to solve this problem? On 2.1 i have added some…
sINFflwies
  • 69
  • 2
  • 6
1
vote
1 answer

req.headers undefined in middleware of nodeJS typescript

Im new on nodeJS. Im developing a rest API using node and typescript. This api has to read an auth token from the request headers. in order to do that, i have created a middleware to run on a GET endpoint. import { Request, Response,…
1
vote
1 answer

How to secure Koa.js application against CSRF attacks?

I know that Cross-Site Request Forgery (CSRF) is an attack that forces an user to execute unintentional actions some web application in which they are already logged in. I want to prevent CSRF on calls being made to my Koa.js based APIs and form…
Temp O'rary
  • 5,366
  • 13
  • 49
  • 109
1
vote
1 answer

Can you add a Browsable API into an ASP.NET application?

The Django web framework has a Browsable API and I would like to implement something similar in my ASP.NET (with ReactJS) application. Essentially, suppose that there's an API endpoint called api/test; I would like to be able to navigate to…
Matthew Miller
  • 555
  • 3
  • 15
1
vote
1 answer

User roles and permissions. Laravel Fortify (and not only)

Is there any ready-made functionality in the Fortify package for setting user roles and permissions (regular user, admin, main admin, etc.)? If not, what is the correct way to implement it yourself? Alternatively, create middleware and an is_admin…
Hi_TecH
  • 427
  • 5
  • 21
1
vote
0 answers

Why should I use an async function in the callback in the mongoDB middleware?

So, I am doing a course on web development and I'm doing mongoDB middleware stuff and I noticed the teacher was using an async function instead of a simple one and I really don't see the difference, I mean I understand the concept but I don't see…
Scythe
  • 31
  • 3
1
vote
0 answers

Access response Object in typescript class member function in Node.js

I want to use NextFunction(next() for accessing next middleware) in the member functions of the class for redirecting to next middleware after sending mail. File : Errors.ts import { NextFunction, Request, Response } from 'express'; export class…
Vishwanath
  • 11
  • 4
1
vote
2 answers

Middleware Function That Checks If User Is Authenticated

I have an Express middleware function that is checking if the user is authenticated. If they are not authenticated, I want to send some JSON to my frontend that says this, but if they are, I want to continue with my normal function at this…
Tejas_hooray
  • 606
  • 1
  • 6
  • 16
1
vote
1 answer

How to enforce dependencies between middlewares in Koa?

I've got a few middlewares in my app: loggedInUserHandler: Loads the current user and saves it the context notificationHandler: Gets the current user from the context. Then loads the notifications for this user and saves them to the…
laurent
  • 88,262
  • 77
  • 290
  • 428
1
vote
1 answer

How do I use Cross-Site Request Forgery prevention correctly in a Clojure HTTP client calling a Ring REST route?

I'm still learning Clojure (and all those accompanying libraries...), so if I do anything stupid in my ignorance, feel free to point it out :-) I have trouble calling REST endpoints via the POST method from client code. My routes are wrapped using…
frIT
  • 3,213
  • 1
  • 18
  • 22
1 2 3
99
100