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
13
votes
2 answers

Using express.static middleware in an authorized route

I'm using node with express and passportjs to restrict access to files located in a private folder. I have reduced my code to the following. Everything in the public static folder works great but route targeting the private folder through the use of…
eephillip
  • 1,183
  • 15
  • 25
12
votes
2 answers

difference between app.js and index.js in Node.js

I am newbie to Nodejs. I have an app.js and an index.js inside the route directory. I have an app.use(multer....). I also have app.post('filter-reports') defined which actually uploads the file contents to the server. I have business logic to be…
zilcuanu
  • 3,451
  • 8
  • 52
  • 105
12
votes
9 answers

Error: Cannot find module 'connect'

It appears that this simple app can't find the 'connect' module after I just installed it in the file directory. var connect = require ('connect'); connect.createServer(function(res, req, next) { res.simpleBody("Connect you son of a…
Architek1
  • 2,051
  • 3
  • 15
  • 17
12
votes
1 answer

socket.io parse connect (>= 2.4.1) signed session cookie

With the latest version of connect (as of 2012-07-26), I've found the following way to get a session ID from socket.io that will work with a connect-redis store. var express = require('express') , routes = require('./routes') , fs = require('fs') ,…
11
votes
2 answers

Routes with parameters gets called twice?

I am creating a NodeJS web application via ExpressJS. I have the following two routes (among others): app.get('/user/reset/verify', function(req, res) { console.log("Executing verification index."); …
Stephen Watkins
  • 25,047
  • 15
  • 66
  • 100
11
votes
2 answers

Express js body parser not working and req.body is undefined?

I have the following in my node server using Express (truncated to the important parts): var app = express.createServer(); app.all(/test/,function(req,res){ console.log(req.headers); console.log(req.body); res.send(""); }); function…
Jesse
  • 10,370
  • 10
  • 62
  • 81
11
votes
1 answer

What does (NodeJS) Express provide over just using Connect?

What does Express provide over just using Connect? Most of the features of Express seem to be features of Connect. Is there a list of what Express provides?
fadedbee
  • 42,671
  • 44
  • 178
  • 308
11
votes
2 answers

In App redirect in expressjs using middleware

I am trying to make a middleware for handling url aliases, what I am doing right now is : // [...] module.exports = function() { return function(req, res, next) { // getAlias would get an object {alias:"alias/path",source:"/real/path"} or…
redben
  • 5,578
  • 5
  • 47
  • 63
11
votes
2 answers

express/connect middleware which executes after the response is sent to the client

Is it possible to write a middleware which executes after the response is sent to a client or after the request is processed and called just before sending the response to client?
Selvaraj M A
  • 3,096
  • 3
  • 30
  • 46
10
votes
3 answers

How to use cookieSession in express

I'm trying to use the built in cookieSession object of connect, but I cannot get it to work properly with express. I have this app: var express = require('express'); var connect = require('connect'); var app =…
mihai
  • 37,072
  • 9
  • 60
  • 86
10
votes
2 answers

Scope of middleware functions in express.js

I'm learning express.js / node.js and have a good but not excellent understanding of the javascript prototype model. Hence, I'm a bit confused on the way middleware can be stacked in express.js's routing mechanisms. Say we have this code function…
shredding
  • 5,374
  • 3
  • 46
  • 77
9
votes
2 answers

How to get Stylus to work with Express and Connect in CoffeeScript

My app.coffee looks like this: connect = require 'connect' express = require 'express' jade = require 'jade' stylus = require 'stylus' app = express.createServer() # CONFIGURATION app.configure(() -> app.set 'view engine', 'jade' app.set…
Alfred
  • 7,071
  • 4
  • 27
  • 35
9
votes
1 answer

Live reload fails - Failed to load resource: net::ERR_CONNECTION_REFUSED

I am starting live reload via Gulp: var $$ = require('gulp-load-plugins')(); gulp.watch('*', function (file) { $$.livereload().changed(file.path); }); gulp.task('connect', function(){ var connect = require('connect'); return connect() …
Dmitri Zaitsev
  • 13,548
  • 11
  • 76
  • 110
9
votes
2 answers

HTTPS with nodejs and connect

I'm currently using nodejs with connect as my HTTP server. Is there anyway to activate HTTPS with connect? I cannot find any documentation about it.
Herry
  • 455
  • 3
  • 14
8
votes
2 answers

How would one make connect/express use non-expiring caching on a particular directory

I'm working on an app that uses connect/express with node.js. It uses the "static" middleware like this: var express = require("express"); var io = require("socket.io"); var app = express.createServer( express.static(__dirname +…
Brandon Lockaby
  • 646
  • 5
  • 12
1 2
3
19 20