Skip to main content
Filter by
Sorted by
Tagged with
244 votes
15 answers
380k views

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's user avatar
  • 10.7k
305 votes
4 answers
86k views

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 ...
Aust's user avatar
  • 11.6k
332 votes
10 answers
264k views

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('/...
user2791897's user avatar
  • 3,329
657 votes
9 answers
156k views

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's user avatar
  • 18.8k
53 votes
9 answers
89k views

I use Laravel 5.2 and have a problem with middleware. There is the code in the routes.php use Illuminate\Contracts\Auth\Access\Gate; Route::group(['middleware' => 'web'], function () { ...
imladris's user avatar
  • 595
11 votes
1 answer
11k views

I am writing an app using FastAPI. Parts of my code raise different exceptions, which I need to process. I want all that processing to be done in a single place (with different except blocks depending ...
TheMemeMachine's user avatar
109 votes
3 answers
132k views

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 ...
Anthony's user avatar
  • 14.5k
42 votes
2 answers
67k views

I have read FastAPI's documentation about middlewares (specifically, the middleware tutorial, the CORS middleware section and the advanced middleware guide), but couldn't find a concrete example of ...
Dean Gurvitz's user avatar
  • 1,142
18 votes
3 answers
13k views

django's User model has a last_login field, which is great if all the users were to log out each time they leave the site, but what if they don't? How can I track when a user who never logged out and ...
la_f0ka's user avatar
  • 1,773
246 votes
15 answers
176k views

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 ...
Michel's user avatar
  • 9,480
36 votes
3 answers
34k views

I'm new with that technology React-Redux and I would like your help with some implementation. I want to implement one chat application with sockets (socket.io). First, the user has to sign up (I use ...
DustInTheSilence's user avatar
24 votes
6 answers
61k views

I am getting form data in this form '------WebKitFormBoundarysw7YYuBGKjAewMhe\r\nContent-Disposition: form-data; name': '"a"\r\n\r\nb\r\n------WebKitFormBoundarysw7YYuBGKjAewMhe--\r\n I'm trying to ...
Dan Baker's user avatar
  • 1,837
39 votes
2 answers
30k views

I have a Rack application that looks like this: class Foo def initialize(app) @app = app end def call(env) env["hello"] = "world" @app.call(env) end end After hooking my Rack ...
Michael Gundlach's user avatar
19 votes
4 answers
37k views

Been trying to get the BODY of a request using FASTAPI middleware but it seems i can only get request.headers but not the body. I am in need of the body in order to get a key that I will use to check ...
JC Lopez's user avatar
  • 301
8 votes
1 answer
5k views

I am working on a Django project on Google App Engine. I have a URL like: http://localhost:8080/[company]/projects/project Note that [company] is a URL parameter defined in my urls.py like: (r'(^[a-...
Muhammad Towfique Imam's user avatar
6 votes
4 answers
11k views

I'm trying to disable the CSRF check for a single controller (API), but I'm unable to find how I'm able to achieve this. The pre 3.5.0 CSRF Component had the ability to be disabled on certain request ...
Robin.v's user avatar
  • 797
58 votes
7 answers
43k views

For certain pages I have custom 500, 404 and 403 error handling in my app. So for instance after an unsuccessful database query I'd go: return next({status: 404, message: 'Record not found'}); or ...
ChrisRich's user avatar
  • 8,826
46 votes
12 answers
95k views

(node:13176) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option. (Use node --trace-...
Sagar Nilgar's user avatar
44 votes
9 answers
9k views

I'm working on a Django project and am writing unittests for it. However, in a test, when I try and log a user in, I get this error: MessageFailure: You cannot add messages without installing django....
Phil Gyford's user avatar
  • 15.2k
19 votes
5 answers
25k views

I tried this: Read request body twice and this: https://github.com/aspnet/Mvc/issues/4962 but did not work. I read request body like this: app.Use(async (context, next) => { var requestBody = ...
Alireza Yavari's user avatar
15 votes
4 answers
14k views

I am familiar with the Go middleware pattern like this: // Pattern for writing HTTP middleware. func middlewareHandler(next http.Handler) http.Handler { return http.HandlerFunc(func(w http....
Alex's user avatar
  • 6,211
13 votes
2 answers
7k views

It is suggested in the Mongoose docs that I should be able to control the flow using middleware that plugs in to the "init" hook. However, I have so far had success only with "save" and "validate". ...
ragulka's user avatar
  • 4,352
5 votes
2 answers
5k views

Let's say I have a middleware in Go where I want to override any existing Server headers with my own value. // Server attaches a Server header to the response. func Server(h http.Handler, serverName ...
Kevin Burke's user avatar
  • 65.7k
4 votes
3 answers
9k views

i have declare a middleware that check role of every routes in nuxt.config.js. but want to disable in some pages. // in nuxt.config.js => router: { middleware: ['role'] ...
Sourav Adhikary's user avatar
3 votes
1 answer
17k views

I use Python Selenium and Scrapy for crawling a website. But my script is so slow, Crawled 1 pages (at 1 pages/min) I use CSS SELECTOR instead of XPATH for optimise the time. I change the middlewares ...
parik's user avatar
  • 2,416

1
2 3 4 5
7