connect

Nodejs: Express + RedisStore, req.session undefined

我怕爱的太早我们不能终老 提交于 2019-12-22 06:29:43
问题 I have done this before... I don't follow what I'm doing wrong this time, but I've been struggling for a couple of hours and now consider myself mentally blocked. The corresponding code: app.use(express.bodyParser()); app.use(i18next.handle); app.use(express.methodOverride()); app.use(express.static(__dirname + '/public')); app.set('views', __dirname + '/views'); app.set('view engine', 'swig'); app.set('view cache', false); var session_store = new RedisStore({ client : redis_client}); app.use

Common encrypt/decrypt code example for C# and Node.js/crypto

感情迁移 提交于 2019-12-22 05:49:14
问题 I'm attempting to use Application Request Routing (ARR) in IIS for passing a set of paths to a Node.js website. My issue is being able to get/set the authentication ticket on either side. I just really need a simple example of an Encrypt/Decrypt pair that will work for C# and Node.js close to out of the box with the same results for both. I'll be working on this problem myself as time permits over the next few days, and intend to answer if nobody comes up with an answer before me. My

Express js body parser not working?

与世无争的帅哥 提交于 2019-12-22 03:43:22
问题 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 appStart(cobrands){ app.configure(function(){ app.use(express.bodyParser()); app.use(express.cookieParser()); app.use('/min',express.static('../min')); app.use('/js',express.static('../js')); app.use('/css',express.static('../css')); app.use('/img',express.static(

Express js body parser not working?

半腔热情 提交于 2019-12-22 03:43:04
问题 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 appStart(cobrands){ app.configure(function(){ app.use(express.bodyParser()); app.use(express.cookieParser()); app.use('/min',express.static('../min')); app.use('/js',express.static('../js')); app.use('/css',express.static('../css')); app.use('/img',express.static(

Android USB Host. How do I get permission to use USB devices without displaying a dialog?

三世轮回 提交于 2019-12-21 21:28:58
问题 There android device without a screen . When connecting the USB device automatically appears the system dialog to permit the use of USB. It is necessary to obtain a permit without using the device's screen . It is assumed that the device application will be installed in advance, and when the USB device is connected automatically. How exactly this can be done? 回答1: I made by analogy in the topic. Classes for the correct version of SDK took away. I create the necessary packages and copied to

Regenerate session IDs with Nodejs Connect

痴心易碎 提交于 2019-12-21 12:09:06
问题 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 that. « To regenerate the session simply invoke the method, once complete a new SID and Session instance will be initialized at req.session » Example code: req.session.regenerate(function(err){ // will have a new session here }); After calling the

Error: Cannot find module 'connect'

一笑奈何 提交于 2019-12-21 07:28:25
问题 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 beeeeetch"); }).listen(8000); express@3.1.0 node_modules/express ├── methods@0.0.1 ├── fresh@0.1.0 ├── range-parser@0.0.4 ├── cookie-signature@0.0.1 ├── buffer-crc32@0.1.1 ├── cookie@0.0.5 ├── debug@0.7.2 ├── commander@0.6.1 ├── mkdirp@0.3.3 ├── send@0.1.0 (mime@1

Socket.IO on subdomains with Express.js vhost

笑着哭i 提交于 2019-12-21 06:24:42
问题 I have two Express.js apps running on my server. A plain vanilla app called "main-app" and another that uses Socket.IO called "socket-app". I have "main-app" running at "mydomain.com" & "socket-app" running on a subdomain at "socket.mydomain.com" I am routing requests to the socket-app via Express's built-in vhost middleware. -- inside main-app.js -- var express = require('express'); var app = module.exports = express.createServer(); app.use(express.vhost('socket.mydomain', require('./socket

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

二次信任 提交于 2019-12-20 12:23:09
问题 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') , http = require('http') , io = require('socket.io') , redis = require('connect-redis') , connect = require('express/node_modules/connect') , parseSignedCookie = connect.utils.parseSignedCookie , cookie = require('express/node_modules/cookie'); var

Using static(), staticCache(), and compress() node.js connect middleware

丶灬走出姿态 提交于 2019-12-20 09:55:37
问题 I have an Express 3.0 app and I'm trying to use the static() , staticCache() , and compress() middleware to serve and compress my static files. This is my current app.configure() function: app.configure(function() { app.use(express.favicon(__dirname + '/public/favicon.ico', {maxAge: 86400000})); app.use(express.bodyParser()); app.use(express.cookieParser('foo')); app.set('views', __dirname + '/views'); app.engine('.html', mustache({cache: true}).render); app.use(express.session({ store: