kraken.js

How to display message using connect-flash and express-messages on .dust file on Node

你。 提交于 2021-02-08 10:09:28
问题 I'm using Nodejs and Expressjs and Kraken , I need to display message when added a product on index but I tried many time for to config but messages still not appear as I expect. Here is my config.js: var flash = require('connect-flash'); app = module.exports = express(); app.use(kraken(options)); //flash app.use(flash()); app.use(function (req, res, next) { res.locals.messages = require('express-messages')(req, res); next(); }); My controller : router.post('/somePath', function (req, res) {

Using dustjs-helpers with Kraken js

点点圈 提交于 2019-12-23 21:44:34
问题 I created a project using Kraken 1.0.1 with yo kraken, with template engine dustjs, but I can not use functions dustjs-helpers. My config.json: "express": { "view cache": false, "view engine": "dust", "views": "path:./public/templates" }, "view engines": { "dust": { "module": "engine-munger", "renderer": { "method": "dust", "arguments": [ { "cache": false}, { "views": "config:express.views", "view engine": "config:express.view engine", "specialization": "config:specialization", "i18n":

Queries hang when using mongoose.createConnection() vs mongoose.connect()

戏子无情 提交于 2019-12-17 03:02:31
问题 Works: var mongoose = require('mongoose'); var db = function() { return { config: function(conf) { mongoose.connect('mongodb://' + conf.host + '/' + conf.database); var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function callback() { console.log('db connection open'); }); } }; }; module.exports = db(); Doesn't work: var mongoose = require('mongoose'); var db = function() { return { config: function(conf) { var db = mongoose

SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message

两盒软妹~` 提交于 2019-12-12 05:37:32
问题 I am using restler, for making rest calls. I tested and got an expected response for the rest call to https://google.com. Now I am trying to make a call to another url location, but there is the following error message: SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message:openssl\ssl\s23_clnt.c:741: I got the expected response using curl for the same url(url is different from here since I cannot share it. Sorry about that). I also tried another rest client as in this link, but

Got a internal server error after I deploy my node js project to the host

落花浮王杯 提交于 2019-12-12 05:09:20
问题 I just finished my project and everything seems OK if I run it on localhost. But after I deploy the project on Heroku, the build process is ok, when I try to access the website, I got an Internal Server Error , I have no idea what the log is going to tell me (I'll paste the log below). VError: Failed to lookup view "index.js" in directory "/app/.build/templates" at /app/node_modules/makara/node_modules/engine-munger/index.js:99:33 at iterate (/app/node_modules/makara/node_modules/engine

Multipart/form-data with arrays

三世轮回 提交于 2019-12-04 09:38:57
问题 I have a simple form: <form method="post" action="/test"> <input type="hidden" name="arr[]" value="val1"> <input type="hidden" name="arr[]" value="val2"> <input type="hidden" name="arr[]" value="val3"> <input type="submit" value="Submit"> </form> With the controller: //... server.post('/test', function(req, res) { res.json(req.body); }); //... This returns fine with: { arr: [ "val1", "val2", "val3" ] } However, when I change the enctype to multipart/formdata <form method="post" action="/test"

Multipart/form-data with arrays

有些话、适合烂在心里 提交于 2019-12-03 03:42:50
I have a simple form: <form method="post" action="/test"> <input type="hidden" name="arr[]" value="val1"> <input type="hidden" name="arr[]" value="val2"> <input type="hidden" name="arr[]" value="val3"> <input type="submit" value="Submit"> </form> With the controller: //... server.post('/test', function(req, res) { res.json(req.body); }); //... This returns fine with: { arr: [ "val1", "val2", "val3" ] } However, when I change the enctype to multipart/formdata <form method="post" action="/test" enctype="multipart/form-data"> <input type="hidden" name="arr[]" value="val1"> <input type="hidden"

Queries hang when using mongoose.createConnection() vs mongoose.connect()

跟風遠走 提交于 2019-11-26 16:06:02
Works: var mongoose = require('mongoose'); var db = function() { return { config: function(conf) { mongoose.connect('mongodb://' + conf.host + '/' + conf.database); var db = mongoose.connection; db.on('error', console.error.bind(console, 'connection error:')); db.once('open', function callback() { console.log('db connection open'); }); } }; }; module.exports = db(); Doesn't work: var mongoose = require('mongoose'); var db = function() { return { config: function(conf) { var db = mongoose.createConnection('mongodb://' + conf.host + '/' + conf.database); db.on('error', console.error.bind(console