4,665 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
1
vote
1
answer
85
views
Passing user data from NextJS middleware to the client component
I want to pass the data from the NextJS middleware to the client component. I am using NextJS for the frontend, and an Express API for the backend.
I could do it with X-Headers but what I want to send ...
Best practices
0
votes
3
replies
73
views
Apply [ApiController] to all controllers implicitly
Adding [ApiController] on a controller class has various benefits. Especially the automatic model validation and problem details parts.
The problem with this attribute is that it's easy to forget to ...
1
vote
0
answers
43
views
Bun + Express on Vercel: How to Modularize Routes from Separate Files?
I'm deploying a Bun + Express application to Vercel. Locally, my Express app works perfectly with routes defined in separate files and imported into index.ts. However, on Vercel, the deployment ...
Advice
0
votes
0
replies
58
views
How to properly build an HR Management System using Laravel (API) + Next.js (frontend) with token authentication and middleware?
I'm building an HR Management System using:
Backend: Laravel
Frontend: Next.js
Authentication(SPA): Laravel Breeze (already set up for backend)
I'm a beginner in Next.js, and I’m a bit stuck on how ...
1
vote
1
answer
86
views
Zustand persist doesn't execute in testing
I am doing unit testing for my project.
This is the code I want to test:
import { create } from "zustand";
import { persist } from "zustand/middleware";
interface LanguageState {
...
-4
votes
1
answer
74
views
How to restrict routes in next js
I need want to send the only authenticated user to the /chat route in next js how to do ut using the middleware? Although I created a middleware and place it inside the root folder it dosen't detect ...
2
votes
1
answer
92
views
Why i cannot set property userId on this function?
I’m building an authentication system with Express + JWT + Cookie.
I have a middleware userAuth that decodes the token and puts the userId into req.body.
Here is the code:
import jwt from "...
2
votes
1
answer
136
views
Trying to write a unit test to test a fastapi app with a middleware that changes the request.url.path
This is the code below. I want to test a request coming in that has part of its path prefixed by external means. This middleware removes it before servicing the request.
app = FastAPI(
title="...
0
votes
0
answers
55
views
Session token/headers not detected in production (Vercel)
When deployed, it fails
Cookie validation
Bypass Vercel firewall rules for API routes
even though cookie + header is seen from the browser
middleware.ts
import { NextResponse } from 'next/server';
...
0
votes
0
answers
47
views
Can't access headers.origin in NextJS middleware (App router)
I'm trying to follow the basic tutorial provided by NextJS to setup a middleware for my API. When trying to restrict origin (for testing purposes) to http://localhost:3000, the request.headers.get('...
0
votes
2
answers
258
views
Middleware not triggering in Next.js app using next-auth
I’m working on a Next.js 14 app with the App Router and next-auth@5. I followed the official Next.js Learn guide on authentication, except I replaced email with username in the database.
I set up ...
-1
votes
0
answers
27
views
Is the route handler in Express also considered part of the middleware chain? [duplicate]
I understand that middleware functions in Express use the (req, res, next) signature and are added using app.use()
But since a route handler also receives (req, res) or even (req, res, next), is it ...
0
votes
1
answer
159
views
Difference between RequestDelegate and Middleware in ASP.NET Core?
I was recently in a technical discussion with a senior developer and was asked:
What is the difference between RequestDelegate and Middleware in ASP.NET Core?
I have already visited the following ...
2
votes
1
answer
194
views
How to get remaining ASP.NET Core session expiry time to return it to the client?
I'm working on an ASP.NET Core Web API where I use session middleware with a configured idle timeout, e.g.:
services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromMinutes(20);
});
...
0
votes
1
answer
109
views
$request->getAttribute('fe_user') returns NULL in Typo3 v13
I'm new to TYPO3 v13 and am currently trying to write a small login middleware, really simple at first. But somehow I can't get any further with $request->getAttribute(‘fe_user’). It always returns ...