Questions tagged [express-4]

Express is a minimalist web framework for Node.js which provides a set of features for web and mobile applications.

Express is a minimalist web framework for Node.js which provides a set of features for web and mobile applications.

Helpful links

105 questions
2
votes
2 answers

Getting/reading res.status() value from Express server response

We can the response code with: res.status(v); but later on for the same request, how can we check to see if it has been set? I am looking at the Express docs and not seeing how to do something like: res.getStatus() // => 500
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
2
votes
3 answers

Update fields of Mongoose document object from request body

The question(Mongoose save all parameters from request body) shows how to create new mongoose document object with request body in a line of code. Extending this question, I want to know how to set all fields of mongoose document object at once. …
Hill
  • 3,391
  • 3
  • 24
  • 28
2
votes
0 answers

Why node.js server in Visual Studio for Azure is created differently?

I ran into strange problem in my Azure project which seems to be related to how server is created. The project was created using the Basic Azure Node.js Express 4 Application template in Visual Studio 2013 Ultimate. After some struggle, the project…
newman
  • 6,841
  • 21
  • 79
  • 126
2
votes
2 answers

Correct modular structure of nodejs+express app for API

I'm trying to do nodejs app for API, using Express 4. But when I make app more modular, my routes doesn't work. Can anybody explain me what is my error and what should be correct structure of application for API ? My app.js file (some unnesessary…
LIAL
  • 1,624
  • 4
  • 24
  • 30
2
votes
0 answers

Node Express Busboy Files and Fields Upload

When using Busboy with express to handle image uploads, I can get the fields and files of a multipart/form-data post like so: var busboy = require('connect-busboy'); app.use(busboy()); app.post('/something', function(req,res) { …
2
votes
1 answer

Node JS & Socket.io Advice - Is it better to post information to a database through a route, or through the socket?

I am currently building a new application which, at a basic level, lets users add a task which needs to be completed, and then lets a different group of users pick up the task and complete it. Previously, I took over building a real-time chat…
k2099
  • 35
  • 1
  • 5
2
votes
1 answer

Socket.io not working with Express 4 without using diffrent port number

My application works when i specify a port number to socket.io that is diffrent from the server port number. The working code goes as follows: This is my app.js file: var express = require('express'); var path = require('path'); var favicon =…
jvjefke
  • 21
  • 5
2
votes
1 answer

Access flash messages from Jade in Express 4

I am currently learning NodeJS using the Express framework. For some reason, there's not alot of guides for Express 4, but alot for Express 3. I am trying to pass errors from a "register" function back to the Jade template using…
Sven
  • 5,155
  • 29
  • 53
2
votes
0 answers

Express.js 4.0 -- use separate view directory for each router

I'm using Express 4 routers to separate out two different app functions. Each app function has its own set of ejs view templates, with conflicting names (e.g both have a search.ejs). How can I specify the router to use only a particular view…
Erich
  • 2,509
  • 2
  • 21
  • 24
2
votes
1 answer

Using Express 4 how to redirect to my own route without losing req and response data?

I have my application structured with 3 Routes (api, admin, default). Each lives in there own file and has it's own middleware and exports a Route. The problem I am facing is when I want to forward to another route that lives on a different router.…
MondayPaper
  • 1,569
  • 1
  • 15
  • 20
1
vote
0 answers

How to display flash messages on the same page without render or erasing the values in textbooks in express js

I'm working on a registrations page in express.js (using mongodb on serverside) and working on the validations part. My user.js looks something like this - router.post('/register', [ check('firstname', 'Please enter your first…
Mahesh m
  • 39
  • 1
  • 8
1
vote
1 answer

ExpressJS: Can't login using passport.js

This is my first time using passport in an expressJS project. I'm facing an issue though. When i'm trying to login, i'm submitting my data and the app always fails to authenticate. My app.js file includes these, that are related to passport: //…
we_mor
  • 478
  • 5
  • 20
1
vote
0 answers

Expressjs 4: Browser's POST request Returns Cannot GET / ... status of 404

I just tried the following express 4 app, that simply sends a selected fruit from client to server and server suppose to respond back the name of the fruit. I got this example from here. The original example uses the template engine nunjucks by…
1
vote
0 answers

Bypass passport authentication on server-side GET requests

Technology: nodejs server/express 4 framework I'm struggling with finding a way to bypass the passport authentication when making a localhost GET request. The "body" part of the response is the login page instead of data. I'd like to just query the…
LucasSeveryn
  • 5,984
  • 8
  • 38
  • 65
1
vote
1 answer

Express4 error middleware sequence

Came accros a sequence of code execution which I found unusual here is the code: server.js const Actions_Single_PVC = require('./routes/Actions_single_PVC.js'); app.use('/Actions_single_PVC', Actions_Single_PVC); app.use((err, req, res, next) =>…
Willem van der Veen
  • 33,665
  • 16
  • 190
  • 155