Questions tagged [express]

Express is a minimal and flexible Node.js web application framework providing a robust set of features for building web applications.

Express is a minimal and flexible Node.js web application framework providing a robust set of features for building web applications.

The official website of Express is expressjs.com. The source can be found on GitHub.

Useful links:

Older versions

76920 questions
13
votes
1 answer

req.files is undefined when uploading file with multer

I am trying to build a Node.js Application in Express.js 4 that uploads an image. I decided to use the multer module but cannot access the uploaded file through req.files. Here Is the code I am using. I restricted it to those parts that I believe…
arne.z
  • 2,720
  • 2
  • 20
  • 41
13
votes
2 answers

save object in module and access it from different modules

I am using the following code to parse json data and keep it internally in my module, for example when the server is (like npm server.js) I'm using the function parse which parses the json files. At the end these parsed jsons are kept in the object…
07_05_GuyT
  • 2,347
  • 10
  • 33
  • 77
13
votes
3 answers

multer configuration with app.use returns TypeError

I'm trying to configure multer in my app.js file (using node.js/express) in order to allow users to upload images. I have the following code in app.js: //various require statements for passport, cookie parser, etc.. var multer =…
prcbass
  • 339
  • 1
  • 3
  • 17
13
votes
2 answers

Concat MP3/media audio files on amazon S3 server

I want to concatenate the files uploaded on Amazon S3 server. How can I do this. Concatenation on local machine i can do using following code. var fs = require('fs'), files = fs.readdirSync('./files'), clips = [], stream, …
ghost...
  • 893
  • 1
  • 14
  • 32
13
votes
1 answer

Why response 304 doesn't have Content-Type header?

I've been playing with express.js trying to return simple json object and noticed that even though I explicitly set Content-Type header to be application/json it is only visible on first response when status code is 200. Every following response…
Andriy Horen
  • 2,609
  • 4
  • 15
  • 36
13
votes
3 answers

Parsing Post Form Data Node.js Express

I am getting form data in this form '------WebKitFormBoundarysw7YYuBGKjAewMhe\r\nContent-Disposition: form-data; name': '"a"\r\n\r\nb\r\n------WebKitFormBoundarysw7YYuBGKjAewMhe--\r\n I'm trying to find a middleware that will allow me to access…
Dan Baker
  • 1,607
  • 3
  • 20
  • 36
13
votes
3 answers

node express how to render handlebars html page to file

I want to convert some html page to pdf via wkhtmltopdf. However, the html page I want to convert to pdf is dynamically generated using handlebars. So I think one solution maybe to generate the html page via handlebars but to a file (html file).…
Manuel Rivera
  • 481
  • 1
  • 6
  • 14
13
votes
2 answers

Register service worker failed with localhost

I have the following error when I try to register a service worker in a basic app served by a node Express V4 server / on Chrome 42: DOMException: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the…
benek
  • 1,916
  • 2
  • 20
  • 35
13
votes
3 answers

req.headers.origin is undefined

Fairly new to Node and Express. I have a sails.js app that relies on knowing the origin of a request as I need to authenticate the request is coming from a domain that is registered. I've seen in the logs that the origin is empty occasionally, why…
Giles Butler
  • 922
  • 3
  • 14
  • 23
13
votes
3 answers

Node JS Configuration

I am trying configure my node js to run my html code.I am using bootstrap and Express Js also.When I run node js its not loading the css.Can anyone help me what could be the issue.Here is the node js code snippet. var express =…
Anil Samal
  • 1,306
  • 1
  • 13
  • 25
13
votes
7 answers

Why does express.js return an empty array when using res.send()?

I have this object that contains an array of key and value pairs. console.log(myObject); [ 'askdasuni.com': '11111', 'capsfrom2011.com': '22222', 'defusionet.com': '33333' ] When I call res.send(myObject) in my application I get the…
user198736
13
votes
2 answers

How to set content type globally in node.js (express)

I might be wrong but I wasn't able to find this in any documentation. I am trying to set content type globally for any response and did it like: // Set content type GLOBALLY for any response. app.use(function (req, res, next) { …
Cristian Boariu
  • 9,331
  • 12
  • 87
  • 159
13
votes
1 answer

Node/Express: concurrency issues when using session to store state

So, I've searched quite a bit for this and found several somewhat similar questions, none of them really addressing the problem though so I thought this deserved a question of its own. I have an express application with a bunch of routes that modify…
JHH
  • 6,514
  • 5
  • 28
  • 64
13
votes
3 answers

node-sass-middleware not compiling

Im trying to get the node-sass-middleware working with with express. The app runs with no errors ...(modules) var sassMiddleware = require('node-sass-middleware'); var routes = require('./routes/index'); var app = express(); // uncomment after…
Aidan Gee
  • 548
  • 1
  • 11
  • 26
13
votes
3 answers

req.session.passport is empty, deserializeUser not called - ExpressJS, Passport

I am having problems using sessions in Passport/ExpressJS. When I log req.session, I can see that passport is {}: { cookie: { path: '/', _expires: Mon Sep 29 2014 19:37:16 GMT-0300 (BRT), originalMaxAge: 3594522, httpOnly: true, secure:…
Larissa Leite
  • 1,256
  • 3
  • 19
  • 30
1 2 3
99
100