Questions tagged [express]
Express.js is a minimal and flexible Node.js web application framework providing a robust set of features for building web applications.
express
95,787
questions
1
vote
0
answers
7
views
Typescript: Variable inside Express RequestHandler becomes possibly undefined despite being checked in an if statement
I am creating a way to dynamically create routes before the server fully starts (meaning I'm not creating a route via a request lol that would be crazy), and I stumbled upon this interesting quirk.
...
0
votes
0
answers
6
views
Axios Post Still Blocked Even Though "Access-Control-Allow-Origin", "*" Set On server
In my backend I've set the following endpoint
router.post("/sign-in", async (req, res) => {
try {
//Extracting email and password from the req.body object
const { email, ...
-2
votes
0
answers
21
views
Why res.clearCookie() is not working after deploying to vercel?
First of all, everything works fine when running on localhost.
However, after deploying the app to Vercel when the user tries to log out it should clear cookies with res.clearCookie() but it doesn't ...
0
votes
0
answers
14
views
Aggregate vs Populate methods when to use one in nodejs Mongose
I am creating asset managment tool for warehouse and I have Warehouse , Asset, Category models. I want to get the overall stats of each warehouse like , total assets and how many of them is active or ...
0
votes
1
answer
21
views
Ways to create a login using nodejs
So i am learning nodejs i am trying to create a login
here what I made so far it works
it connects to mongodb and check if the field if same then changing the allow variable to true
any ways to create ...
1
vote
0
answers
21
views
Having trouble sending an image from Express to React client
In express, I'm using the google places api to get city images. I'm having trouble sending the response to my react client.
here's my express route:
router.get('/', async (req, res) => {
const { ...
0
votes
0
answers
8
views
How to handle Authentication and private routes in React-native + Node.js?
I want a good way to handle Authentication in React-Native. I was planning on using JWT tokens and make the accessToken refresh without making the user ever log-in again(assuming they have a ...
-2
votes
0
answers
20
views
Server is started successfully but getapi is not loading in nodesjs [closed]
I am working on an Express.js application and encountered an issue with routing. Here is what I have done so far:
Controller:
exports.dummyLink = (req, res) => {
res.send("this is your dummy ...
0
votes
0
answers
5
views
Creating first Turbo Repo package for a logger failing to import
I am working to setup my first Turbo Repo project using a mix of Next for the UI and Express for the API. I am trying to create a logging package I can include in the API app but also eventually the ...
-1
votes
0
answers
14
views
CSP not showing on browser
I'm quite new to coding, and I'm developing an application using Express, Node JS and Angular. Right now, I am focusing on security, so I did some research and found the Content Security Policy, which ...
0
votes
0
answers
8
views
Node.js Express Server with Axios and MySQL2 stuck in pending preflight OPTIONS request
I am developing a service system where the customer picks up a ticket to be served and the counter selects the ticket numbers of the customers who are waiting in sequence. It is a system that works on ...
0
votes
1
answer
16
views
express-session does not persist session by cross site request
My client/server architecture:
Client (Frontend): Vue (Vite)
Server (Backend): Express.js
Currently i use only the http, because it's a develop enviornment.
For safe request purpose handling, i use ...
0
votes
0
answers
14
views
How can I fix react hooks in a React SSR project?
I try to migrate an existing project in js using express and ejs to render templates. I used react and react-dom. But the issues are that hooks and onChange don't work. I'm going to share the client ...
-1
votes
0
answers
29
views
JWT expires after refreshing page
I created a authentication system and thus was setting a JWT token in a cookie. However when I refresh the page it is getting deleted, even though I am setting it's expiry to be 24 hours.
jwt.sign(...
0
votes
0
answers
9
views
IIS Reverse Proxy with NextJS + NodeJS API
I have an NextJS website running on a Windows Server on port 3000. I've setted the URL Rewrite to redirect all the requests to port 3000 on the server and everything works fine, the Frontend works ...
0
votes
1
answer
39
views
calling axios multiple times
I am trying to make a fetch function where upon fetching the transaction data, it will run a payout function to pay the person, and then it will update the transaction data value 'go' to false so that ...
-1
votes
0
answers
10
views
template inetgration options other than template engine [closed]
I am working on an Express.js project where I need to replace placeholders in an HTML file with data from a JSON file. However, I want the HTML file to look like an actual page instead of having ...
0
votes
0
answers
29
views
How to properly package a Node.js and React app stripping the container of all unneeded files?
I have a Node.js backend that serves up the React frontend (later I can do CDN probably) and for now, I plan on disallowing CORS so React must talk to my Node.js backend only. The prototype for this ...
0
votes
0
answers
6
views
Error with Express.js library with res.cookie, res.json, res.status, req.headers
Errors appear in the code:
Property 'cookie' does not exist on type 'Response any, Record string, any
Property 'json' does not exist on type 'Response any, Record string, any
Property 'status' does ...
-4
votes
0
answers
21
views
Good day. I'm Asadbek from Uzbekistan [closed]
I'm working on ejs express project and why when i set url to route handler like /contract ejs is being rendered properly but when i set api like /all-org/contracts is not rendring properly.
My routes ...
0
votes
0
answers
12
views
Ngxin does not return real ipv4 behind cloudlfare (nginx+express+cloudflare)
I want to get ipv4 of clients instead of ipv6
And I use express in nodejs and my domain behind cloudflare
This is my nginx:
server {
server_name xxx.xxx.xxx www.xxx.xxx.xxx;
# cloudflare
...
0
votes
0
answers
27
views
CORS error with deploying an express js server with vercel
Followed the instructions here to run an express server but I'm dealing with CORS errors when calling the backend via my next js app.
How can I make this work? Suggestions for alternate deployment ...
0
votes
1
answer
37
views
Getting 404 AxiosError: Request failed with status code 404
Could you please help me to solve the problem with the routes.
In result I have the next code:
// server/index.js
// server/index.js
const express = require('express');
const bodyParser = require('...
-1
votes
0
answers
19
views
ObjectId() gets depreciated
whenever I am using new mongoose.Types.ObjectId(id) object id gets depreciated and I am getting this - The signature '(inputId: number): ObjectId' of 'ObjectId' is deprecated.ts(6387)
bson.d.ts(1247, ...
0
votes
0
answers
19
views
Shopify Customer Account API: "client_id invalid" Error on Authorization Request
I'm trying to implement the Shopify Customer Account API following the Shopify documentation here. I'm currently working on the authorization step, where I need to redirect a customer to the login ...
0
votes
2
answers
33
views
Stripe CLI trigger subscription failed event for a specifc customer
Evening,
When a user signs up for a subscription the checkout.session.completed event is fired and I can test that everything is working correctly via the CLI command: stripe trigger checkout.session....
0
votes
0
answers
18
views
Why does clearing all sessions make my NestJS app unresponsive?
I have a NestJS app, with a special Admin route I want to be able to call to clear out all user sessions (for example: after we deploy a new version of the application so we can kick everyone out).
I ...
0
votes
1
answer
27
views
req.headers.auth is undefined In jwt and express js
I'm new to use jwt library ..
So I made a login form and if it success it generates token and verify but it generates token and respond that token , but I can't get that token in req.headers....
0
votes
1
answer
31
views
Auth Setup for NextJS frontend and ExpressJS backend with MongoDB
I am building a full stack app with Next JS frontend and Express JS backend with MongoDB as the database. I want to implement authentication using email and password, as well as with Google Provider. ...
-1
votes
0
answers
20
views
Uncaught SyntaxError: Unexpected token '<' - swagger
I have included swagger in express and deployed on vercel. Swagger is working fine locaally but giving Uncaught SyntaxError: Unexpected token '<' in browser console when i deploy app to vercel. ...