How can I set NODE_ENV=production on Windows?

In Ubuntu it's quite simple; I can run the application using: $ NODE_ENV=production node myapp/app.js However, this doesn't work on Windows. Is there a configuration file where I can set the attribute?

NodeJS / Express: what is "app.use"?

In the docs for the NodeJS express module, the example code has app.use(...). What is the use function and where is it defined?

Display Pdf in browser using express js

I'm trying to serve a PDF via Express in a way it is displayed in browser: app.post('/asset', function(request, response){ var tempFile="/home/applmgr/Desktop/123456.pdf"; ...

Node.js, PostgreSQL error: no pg_hba.conf entry for host

I am following this article ((http://nodeexamples.com/2012/09/21/connecting-to-a-postgresql-database-from-node-js-using-the-pg-module/). I have already deployed my app to heroku and currently...

ExpressJS : res.redirect() not working as expected?

I've been struggling for 2 days on this one, googled and stackoverflowed all I could, but I can't work it out. I'm building a simple node app (+Express + Mongoose) with a login page that redirects...

In express.js, res.render() is not working

I'm making a simple webapp with facebook login. If the facebook login button on my page is clicked, FB.api( '/me', 'GET', {"fields":"id,name,birthday,gender"}, ...

ExpressJS backend put requests into a queue

I have clients sending tasks to be performed by the server but these requests should be handled in a queue like fashion. Any idea how I can do this? Thanks. express.Router().post('/tasks',...

Nested GET request Nodejs Expressjs

i have a problem with my code. I want to create a nested GET request using Nodejs and Expressjs, i use GET reuqest...

How to res.send to a new URL in Node.js/Express?

Given a GET request to URL X, how should you define res.send such that it provides a response to a completely separate URL Y? i.e. app.get('/', function (req, res) { res.send to a new URL...

Keycloak - Grant validation failed. Reason: invalid token (wrong ISS)

So I'm having some issues with getting my Keycloak-Connect sample to work. Basically I have a simple check with Keycloak on an express route On my VM (10.10.10.54:8081) as...

Postman raw data works but form-data not works on POST request in node

I'm facing some problem when using postman. When I'll try to send raw data in JSON(application/json) format, it get success. Postman sending post request and succeded But when I'll try to send...

ExpressJS + Axios : can't send header authorization

I don't understand why express js cannot read my header. I use vuejs + axios for send data. I use a module for intercept request ans response for send token. In axios module...

How to format and validate email node js

I would like that email had format like: [email protected] Which is the best way to do it? I have a component for registration and I have the field like this: <mat-form-field> <input matInput...

Multiple files move into another directory in NodeJS

I want to move multiple files from source directory to destination directory. I tried with multiple package but its moving the folder itself. but i would like to move one the files contain in the...

NodeJS Express async/await

Still getting the hang of Node's non-blocking nature. The following code executes as intended. However, I am wondering if there is a better approach to accomplish the task. There are 3 params...

Can't connect to MongoDB Atlas (queryTxt ETIMEOUT)

I can't connect to MongoDB Atlas either via driver, mongoshell, or MongoDB compass. Get to error: queryTxt ETIMEOUT Error: { Error: queryTxt ETIMEOUT clustermasjeed1-ekpfe.mongodb.net at...

Create a webhook between my front end and back end

So from what I understand about webhooks, I keep looking up "How to create a webhook from my API" but the results keep giving me how to add a webhook (From say GitHub) from different sites. I'm...

You cannot use different slug names for the same dynamic path Nextjs

I'm using the default dynamic routing technique of nextjs in my project which is based on the folder structure. I have a route which is: pages/[language]/location/[location_id] Now I'm coming...

How to create Mongoose schema for 3 users i,e Admin Manager and Employee?

i am working on MERN STACK app.. i want to create 3 users schema i,e Admin employee and manager pease help me out how create that 3 users schema

TypeError: Cannot read property 'name' of undefined Passpor error

I'm making a login and register page. I'm using passport to do the authentication. I'm using mongosse too. Everything is working fine, however I do not know why user.name is undefined. I tried...

BrowserSync with Nodemon and Express Server

For the life of me I can't get Browser Sync and Nodemon to run nicely alongside my Express server. I have tried every combination I can imagine. My Express server runs at port 5000 which I can...

How to set a nullable database field to NULL with typeorm?

This seems like such a simple question to answer, but finding an answer for this seems impossible. I am building a password reset feature for a backend application with Express and Typescript. I...

Property `user` does not exist on type `Session & Partial<SessionData>`

I had a code in javascript and I'm trying to convert it to typescript route.get('/order', async(req,res) => { var sessionData = req.session; if(typeof sessionData.user === 'undefined') ...

Puppeteer types node_modules/puppeteer/lib/types"' has no exported member 'Cookie'

I have got a problem with puppeteer types, I'm trying to import Cookie type, but it doesn't work on version newer than 6.0.0. import { Cookie } from 'puppeteer'; and the...

Proxy server to my express server is not working in my React app

I am running my react app at port 3000 & express server at port 4000 , on the same local machine. In my react app , using fetch api i am sending my registration form data to my express server at...

Getting no overload matches this call running mongoose with typescript and express

I am getting the below error for useNewUrlParser, useUnifiedTopology, useCreateIndex: No overload matches this call. Overload 1 of 3, '(uri: string, callback: CallbackWithoutResult): void', gave...

NodeJs/Express/MongoDb - ERR_HTTP_HEADERS_SENT

hope you spent really good holidays I'm following a tutorial online but i've an error that the teacher doesn't have in the video (i also copy his code but same error). I have this error only with...

NestJS class-validator validate array of numbers in form data

How can I handle the validation of an array of numbers in form data? Because I am passing data in a form-data format, I can't validate an array of numbers Actually, I don't know how to do...

ERR_CONNECTION_REFUSED for React and axios

I'm trying to build a instagram scraper with puppeteer and react that works with putting the username on an input and then I want to show the scraped data on the console, I already built the...

Deploying to heroku and react front-end not working at all

Been trying to deploy my create-react app (MERN stack) app to Heroku and having problems getting anything React related to display in Heroku. On my local computer it works perfectly fine. In...