Questions tagged [node.js-connect]

Connect is a middleware framework for Node.js. It processes or decorates HTTP requests and responses to provide features such as session handling, authentication, asset management or compression.

298 questions
8
votes
2 answers

Regenerate session IDs with Nodejs Connect

I'm using a Node.js server and I'm developing with the Connect framework. I'm trying to regenerate SIDs after a given interval to avoid session fixation. There's a method called req.session.regenerate which, according to the docs, should do just…
8
votes
3 answers

node.js connect-auth app? example (user registration / user / session management)

I'm trying to get the hang of node.js and am looking for an authentication example. Hopefully with connect-auth and using http digest with hash and salt. I watched this but it doesn't seem very…
Mark
  • 32,293
  • 33
  • 107
  • 137
8
votes
1 answer

Node Express Connect - Session Management

I've written a session store driver for ArangoDB for ConnectJS. It is working, although still very much in alpha, but I have a couple questions. First sessions that have an expires attribute of "false" only remain for the duration of the user-agent.…
skinneejoe
  • 3,921
  • 5
  • 30
  • 45
8
votes
4 answers

Prevent Expressjs from creating a session when requests contain an authorization header?

I have an API that can be called either using a browser where requests are transactional and have a session OR directly, eg. using curl, where requests are atomic. Browser requests must first authenticate and then use an express session…
Oliver Lloyd
  • 4,936
  • 7
  • 33
  • 55
8
votes
6 answers

How do I combine Connect middleware into one middleware?

I have a few middlewares that I want to combine into one middleware. How do I do that? For example: // I want to shorten this... app.use(connect.urlencoded()) app.use(connect.json()) // ...into this: app.use(combineMiddleware([connect.urlencoded,…
Evan Hahn
  • 12,147
  • 9
  • 41
  • 59
8
votes
4 answers

Get rawBody in express

I am trying to retrieve something from the post, and need the rawBody property from the incoming request. How can I retrieve it? I tried using express.bodyParser() and in my post handler, I was looking for req.rawBody, and it was undefined. I even…
macha
  • 7,337
  • 19
  • 62
  • 84
8
votes
6 answers

Handling text/plain in Express (via connect)?

I am using Express 3, and would like to handle text/plain POSTs. Express 3 uses connect's bodyParser now (I think the old Express code got moved to connect). The documentation for bodyParser gives some details about how to make it support…
mikemaccana
  • 110,530
  • 99
  • 389
  • 494
7
votes
5 answers

Node.js: ECONNREFUSED on Port 80

I've written a web-server using Node.js. When I tried to test my server with the tester I've written for it, I succeed only if the port I'm using for the server is not 80. I've checked on netstat, and no other application is using port 80. The error…
limlim
  • 3,115
  • 2
  • 34
  • 46
7
votes
4 answers

POST array data to Express gets parsed out as JSON

My app is Node.js using Express. Sending this test data from my client using jQuery POST: { title: 'hello', notes: [ {title: 'note 1'}, {title: 'note 2'} ] } And this is the result in my server code: { title: 'hello', notes: { '0': { title:…
JMWhittaker
  • 3,633
  • 3
  • 23
  • 30
7
votes
1 answer

NodeJS - connect-keycloak middleware empty response error

I'm having a problem using the connect-keycloak middleware with NodeJS, and there appears to be very little documentation online from people who have used it. This is based on 'A Full Example' from the official docs found here:…
Nodal
  • 353
  • 2
  • 14
7
votes
2 answers

nodejs connect usage of built in modules -> method not found

when I call this node.js file var connect = require('connect'); var app = connect(); app.use(connect.static('public')); app.listen(3000); I immediately get app.use(connect.static('public')); ^ TypeError: Object function…
ohoservices
  • 226
  • 2
  • 9
7
votes
4 answers

Delete document using findOneAndRemove Mongoose

I am receiving this error when trying to delete a document from the database: Cannot GET /delete/532fa5e56f885c7fec5223b1fds How can I successfully delete the document? app.js //Delete app.del('/delete/:id',…
user2175731
  • 71
  • 1
  • 1
  • 2
7
votes
1 answer

Setting up request cleanup middleware in expressjs

I am trying to write an expressjs server utilizing the postgresql as the backend. Each request starts by calling pg.connect to get a pooled connection (client) as well as the method to return it to the pool once the connection is no longer needed…
mark
  • 59,016
  • 79
  • 296
  • 580
7
votes
2 answers

How to use asynchronous initialization in a Connect middleware?

I wrote a middleware for Connect and Express that requires some heavy lifting in its setup method. Due to the nature of the initialization tasks this stuff is asynchronous, so I have the problem that the middleware shall only be accessible once the…
Golo Roden
  • 140,679
  • 96
  • 298
  • 425
7
votes
1 answer

How to configure the Express response object to automatically add attributes to JSON?

I have an object: var obj = { "stuff": "stuff" } In Express, I send it the client like so: res.json(obj); Is there a way to configure the response object to automatically add attributes to the json it generates? For example, to output: { …
user1031947
  • 6,294
  • 16
  • 55
  • 88