Tag: express

debuggingNode / Express – require('express')创build一个中断

我对Node和Express的相当有限的经验没有帮助,但我在从terminal窗口debugging应用程序时遇到困难。 这是问题: 运行node debug app.js返回: < debugger listening on port 5858 connecting… ok break in server.js:1 1 var express = require('express'); 这是debugging快递应用程序的正确方法吗?

Postgres方言不工作在续集-m

运行Sequelize -m 在我的config.json "development": { "username": "root", "password": null, "database": "**********", "dialect": "postgres", "protocol": "postgres", "port": 5432, "host": "127.0.0.1" }, 出错: sequelize -m Loaded configuration file "config/config.json". Using environment "development". /usr/local/lib/node_modules/sequelize/lib/transaction-manager.js:10 throw new Error("The dialect " + sequelize.getDialect() + " is not support ^ Error: The dialect postgres is not supported. at new module.exports (/usr/local/lib/node_modules/sequelize/lib/transaction-manager.js:10:11) […]

如何使用heroku + node.js + express设置安全Cookie?

我有一个node.js应用程序在雪松堆栈上运行,我很困惑为什么安全cookie不起作用。 "express": "3.0.3", "node": ">=0.8.14", … app.use(express.session({ secret : 'somesecret', store : // store works fine, sessions are stored key : 'sid', cookie : { secure : true, // it works without the secure flag (cookie is set) proxy : true, // tried using this as well, no difference maxAge: 5184000000 // 2 months } […]

Node.js:如何为prod和staging设置不同的variables

我正在使用Express,我需要为每台服务器使用不同的凭据(分段和生产)。 我可以在server.coffee文件中设置variables,但是我需要在不同的文件中访问这些variables。 server.coffee: app.configure 'production', () -> app.use express.errorHandler() 有什么解决scheme? 设置variables,然后导出它们?

MongoError:操作无效,没有批量操作

我无法使用mongoose对mongo进行批量插入。 var mongoose = require('mongoose'); var Schema = mongoose.Schema; // Define our results schema var webSchema = new Schema({"abc" : String},{ collection: 'web_v2' }); MyApi.prototype.Webs= mongoose.model('Webs', webSchema); resultData = [{"abc": "12121221"},{"abc": "44545"},{"abc": "545"}] MyApi.prototype.Webs.collection.insert(resultData, function (err, myDocuments) { if (err) { console.log(err); } else { console.log("web inserted : " + myDocuments.result.n); } }); 我收到以下错误 MongoError: […]

如何使用进度条快速上传大文件?

目前我正在使用socket.io上传video进度条。 这里是教程 http://net.tutsplus.com/tutorials/javascript-ajax/how-to-create-a-resumable-video-uploade-in-node-js/ 但Internet Explorer不支持这种方法,但我真的需要在所有浏览器上传video。 我检查了快递文件。 由于express是基于node-formidable (有一个进度事件),所以我觉得有办法build立一个带有进度条的上传系统,对不对? 我只是不知道如何! 节点强大的IE启用的权利? 任何方式都可以build立一个file upload系统在纯espress.js与进度条?

使用Node.js ENOTFOUNDparsingSDK JavaScript

所以我想在Parse上获取大量的数据,我发现一个很好的解决方法就是做一个recursion函数:当数据成功find时,启动另一个请求。 我这样做的方式非常简单: var containedLimit = 1000, // Also tried with 500, 300, and 100 parseUsersWaiting = { // A lot of Users }, parseUsers = {}, // Recipt for Users getPlayers = function (containedIn) { var count = 0; if (containedIn == undefined) { containedIn = []; for (var i in parseUsersWaiting) { count++; if […]

做任何客户端JavaScript框架与Node.js + Express.js + socket.io.js很好地集成吗?

我正在使用Node.js + Express.js + socket.io.js在后端构build一个Web应用程序。 做任何stream行的前端框架(Agility,Angular,Backbone,Closure,Dojo,Ember,GWT,jQuery,Knockback,Knockout,Spine,YUI等等)都可以很好的与后端的“实时”应用程序集成吗? 我希望我的应用程序具有非常“实时”的感觉。 具体而言,当用户提交表单时,我希望使用Web套接字将信息发送到后端进行validation,并在数据库中更新(如果validation通过)。 然后,服务器端将使用Web套接字来发送确认数据已保存或一些错误列表。 我将使用服务器的响应来使用JavaScript更新页面。 我知道所有这些都可以用任何列出的框架来完成。 我对特定框架的function感兴趣,这将有助于框架与​​基于Node的后端更好地整合,而不是其他框架。

为IE重复请求表示返回304

我遇到ExpressJS的一些奇怪的行为。 在第二次请求我的node.js / express基于API的URL时,它总是返回304未修改的响应代码给IE。 其他浏览器得到200(铬/ FF)。 问题是,即使内容实际上已经改变,它也会返回304。 我试图search,并没有find任何关于这个话题。 此外,我试图find不同的IE和Chrome的请求头,可以看到任何头可能会导致这一点。 任何帮助将不胜感激。 我必须通过SSL添加连接,以防万一

Passport.js + Express.jsauthentication后将用户转发到原来的目的地

我有一个应用程序,是在服务器上的Node + Express + Passport和客户端上的jQuery + Backbone.js。 客户端使用URL中的哈希标签,但对于某些function来说,重要的是用户login。 我希望应用可以通过URL访问,例如http://mydomain.com/app#cone/waffle/flavor/mint/toppings/sprinkles ,以便: 如果用户已经login,他们直接去请求的URL没有麻烦 如果用户还没有login,他们去/login ,然后去请求的URL 在这个SOpost之后, 在Node.js Passport的Google策略上自定义returnUrl ,我已经这么做了 如果他们已经login,他们直接去URL,哈希标签和所有 如果他们没有logging,它会把他们带到login页面,然后到请求的url,但… 它似乎从login后redirect的原始url中去掉散列参数。 有没有办法保存哈希参数时redirect到原来的目的地? 从这篇文章, 从请求url获取散列参数我得到的想法是散列标签不可用在服务器上,这是使用散列标签的整个点。 所以我怀疑这是不可能的。 也许caching在本地参数不知何故,检索他们redirect,说[original URL minus hastags] + #use-cached-params ?