javascript - node.js problems with app.get() function -
i'm trying create site uses mongojs. i'm trying use code below, once run site, never gets app.get() parts, , site ends showing 500 error. how can make respond app.get function?
thanks help!
var express = require('express'); var cookieparser = require('cookie-parser'); var session = require('express-session'); require('node-monkey').start({host: "127.0.0.1", port:"50500"}); //todo: delete var app = express(); var mongojs = require('mongojs'); var db = mongojs('mongodb://localhost:27017/test', ['usersdata']); var usersdata = db.collection('usersdata'); app.use(express.static(__dirname + '/views')); app.use(cookieparser()); app.use(session({ secret: 'keys', resave: true, saveuninitialized: true })); app.get('/', function (req, res) { console.log("here"); });
you have start listen. add line below :
app.listen(port);
Comments
Post a Comment