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,788
questions
0
votes
0
answers
11
views
How to generate openapi doc in express
I'm making a REST service using javascript and express. I have some endpoints and I wanna create a swagger file to serve along with it. I'm using swagger-autogen to generate the swagger file. Even ...
3
votes
1
answer
23
views
Typescript: Variable inside Express RequestHandler becomes possibly undefined despite being checked in an if statement [duplicate]
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
22
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
22
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
10
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. ...
-2
votes
0
answers
17
views
How to do client generation and scaffolding generation [closed]
On my previous project, every client microservice used an API interface to talk to another microservice. The client was generated for all microservices. The generated client translated the DTO request ...
0
votes
0
answers
22
views
Delayed and incorrect updates from react context to backend
I am creating a food ordering application as project. Here, user can add items from a single restaurant only. If they tried adding items from another restaurant too, they will be shown an alert ...
0
votes
0
answers
29
views
FFMPEG - Error during conversion: Input stream error: Status code: 403
const express = require('express');
const ytdl = require('ytdl-core');
const ffmpeg = require('fluent-ffmpeg');
const ffmpegStatic = require('ffmpeg-static');
const app = express();
app.use(express....
0
votes
0
answers
18
views
How to host socket.io server for free? [closed]
Here's a simple express/node socket.io server with simple frontend, the code is taken from socket.io documentation.
Can anyone please tell me a good hosting service for hosting this website, with a ...
0
votes
2
answers
33
views
Why would my parent route in express not pass down the req.params object to its child route?
I'm building an express application that has a users table in its database and a friends table. The point of the friends table is to be a many-to-many table that keeps track of friend requests between ...
-2
votes
2
answers
33
views
Can i make a flexible function that can get * from different tables? [duplicate]
I am trying to create a function that can select from different tables in mysql
My Function
async function getOne(table, table_parameter, parameter) {
const result = await pool.query(
`SELECT * ...
0
votes
0
answers
23
views
Efficiently Remove and Replace Outdated Products in MongoDB with Envato API in Node.js
I have around 200,000 products in my MongoDB database. I need to write a script to remove products that are no longer available on Envato and replace them with new ones. I've written the following ...
0
votes
0
answers
24
views
How can I import CSS modules from my Node server?
I have an Express server that renders React components to a string:
server.get('/', (req, res) => {
res.end(renderToStaticMarkup(<App />));
});
It works as long as App doesn't import CSS ...
-3
votes
0
answers
30
views
Multiple User's are not being able to Connect to the WEBSITE [closed]
There is a problem in my backend that multiple users can't access the website at one's. If User1 login and a User2 arrives at the same time the 2nd User is seeing the interface of User1.
So, What ...
0
votes
1
answer
37
views
How to send several vars to client
I want to send to client many objects and one var, but i don't understand how to choose response that i want and create the var on client.
Server code:
var isAdmin = false;
app.get('/main', async (req,...
-3
votes
0
answers
19
views
How do i fetch data and display in MERN? [closed]
What are the steps to be followed? What are the packages that need to be installed? I am also willing to share my codes if needed.
I tried using Axios and Cors.
This is my JSX code.
import { useEffect,...
0
votes
0
answers
5
views
How to host a express js backend in vercel,i am getting error 404
I am trying to host an express js backend api on vercel
Here its my project structure for the backend folder . I am trying to host the backend folder
everytime it says me 404 error not found
This is ...
0
votes
0
answers
16
views
Express nodemailer custom headers not getting set in the email which is being sent to the reciever user
I have a backend application built with Express.js, and I'm using Nodemailer to send emails. I need to set custom headers in the emails so that I can later read my inbox and group those emails ...
-2
votes
0
answers
17
views
Node js express Events app problem how to resolve this
I have a problem with an exercise where I need to create a list of events, using Node.js, express, socket.io and AXIOS to handle POST and GET requests. Unfortunately, the creation of the event list ...
0
votes
0
answers
21
views
swagger-ui-express unnecessary parameter showing
I am using swagger-ui-express with swagger-autogen with the below configurations, but the req.headers.Authorization is showing as a parameter on the routes that has verifyJWT middleware and as my ...
1
vote
0
answers
31
views
Need help optimizing request forwarding for Node JS API
I am trying to write a front facing API route that will receive an incoming HTTP post request and forward it to a separate server of mine for processing. The reason I have this front facing API is ...
0
votes
0
answers
25
views
Issue with Date Handling in Node.js and MySQL: Date Reduced by One Day
I'm experiencing an issue with date handling in my Node.js and MySQL application where the date stored in the database is correct, but when retrieved via an API, it is reduced by one day. Here are the ...
0
votes
2
answers
62
views
Error uploading node.js project on azure web app through Github CI/CD
I am uploading my node.js code on Azure web app. After a lot of try, I was able to successfully do it. I am building my code on Visual Studio and pushing to Github and using CI/CD connected to Azure ...
1
vote
0
answers
31
views
Post form data inside an array of objects
Hello I've been working in a blog to post blogs, you can add images too
For add image system i use Multer and Path.
To save the image, I save it in a FormData, with its key, so Multer can read the ...