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
0
votes
1 answer

Express 4.0 request data received format

I'm using express 4.0+ and this is my code var express = require('express'); app = express(); var bodyParser = require('body-parser'); app.use(express.static(__dirname + '/public')); app.use(bodyParser.urlencoded({ extended: false…
penguinsource
  • 1,120
  • 3
  • 16
  • 40
0
votes
2 answers

No found page (express 4 + body-parser + form + post)

I want to receive data from client, so I use express 4 and middleware body-parser. But I input url:localhost:5555/book, page show the message: Name: undefined, and I input url:localhost:5555/book/form.html, page show the message Cannot POST…
peggy_Lin
  • 47
  • 6
0
votes
1 answer

Express 4 app.locals getting a cookie value

Ok basically I've got Express 4 running and I want to get the value of a cookie on every page, I felt that app.locals was a good fit for this but I cannot get it grab a cookies value in app.js I tried app.use(function(req,res,next){ …
Coombes
  • 203
  • 1
  • 10
0
votes
1 answer

EJS - Scripts in wrong location

In the interest of DRY, I have 3 page types in my SPA: (1)Layout, (2)Index, and (3)XXXX (view). Layout has the body related tags, Index the nav system, and XXXX the relative content. Here is the code: Layout.ejs: …
user1177440
0
votes
1 answer

Adding Socket.io to an Express 4 Server - multiple file setup

I've been bouncing back and forth between socket.io and express.io - but settled for socket.io with Express 4, as I would like to use Namespaces. I have worked on some examples of having an Express 4 Server using Socket.io - but most examples are…
Pandafinity
  • 713
  • 2
  • 7
  • 19
0
votes
1 answer

Should modules be configured with app.use in all routes at express.js?

I was told that if I want to use one same express module in different route files the proper way of doing it would be to include it in every route file rather than making it globally in app.js. Now I'm wondering if I should duplicate all the app.use…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
0
votes
2 answers

ExpressJS recognize file type

I'm using NodeJS and Express and I have a .unity3d file that won't run because I'm pretty sure NodeJS doesn't recognize it. I researched it and I'm pretty sure it has something to do with NodeJS needing to be served the unity3d file type before it…
Thomas
  • 2,356
  • 7
  • 23
  • 59
0
votes
1 answer

Node.js Express 4 modular routing issues

I've been wrestling with modularizing my node.js express app, I would like each part in it own directory, but cannot seem to get the routing right. each is in for example app/lib/main main being the index which loads fine just not /login or…
0
votes
1 answer

Express JS 4: exported routes and session

i'm quite new to node and i've been working through this issue for some hours now but am failing at finding a solution :/ Perhaps u can help me :) I have exported my routes out of the app.'s into routes.js. There i am having a POST for a…
0
votes
1 answer

Placement of static middleware in express 4

I see that express 4 does not need app.use(app.router). This is combined with app.get/post(). In that case, should I define static middle-ware after all app.[verb]() calls? app.use(express.static(path.join(__dirname, 'public'))); I assume keeping…
ankitjaininfo
  • 11,961
  • 7
  • 52
  • 75
0
votes
1 answer

node js express4 and passport js lengthy sign in

I am using express 4 with passport js to handle authentication of users. The front end is Angular JS. I am basically facing two problems: 1- sign in is lengthy, it takes up to 15 seconds to sign in. 2- once logged in, if i restart the node js server…
Fouad
  • 855
  • 1
  • 11
  • 30
0
votes
2 answers

Nodejs: How can i simply get the request body using express4?

Now that express is not shipped anymore with middleware that fills the req.body variable i am fighting to get req.body filled again. I am sending a POST request to /xyz/:object/feedback. here my code: app.post('/xyz/:object/feedback', function(req,…
Thariama
  • 50,002
  • 13
  • 138
  • 166
-1
votes
1 answer

Node.js parameters do not work properly

Here is my global array with json in my users.js: global.users = [ { 'id':1, 'name' : 'Dain', 'age' : 24, 'hobby' : 'gaming' } ]; The router.get function: router.get('/:userid', function(req, res){ for(let i…
dain
  • 1
  • 1
-1
votes
1 answer

can't understand routing in node/express4

Please, help to clear up the routing issue: var express = require('express'); var path = require('path'); var favicon = require('serve-favicon'); var logger = require('morgan'); var cookieParser = require('cookie-parser'); var bodyParser =…
Dennis
  • 487
  • 5
  • 15
-1
votes
2 answers

node.js, express4, ejs routing exception

I've been writing my first node.js/express test web-app and faced a problem with routing (I think so, but I'm not sure) while developing. Here are some debug info about my problem. I'm using Express 4 and trying to connect router like this: var…
1 2 3 4 5 6
7