diff --git a/package.json b/package.json index caf1445..dbe5b63 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "build": "webpack", "watch": "webpack --watch", "start": "webpack && coffee server.coffee", - "debug": "webpack --watch & coffee server.coffee", + "debug": "webpack --watch & nodemon server.coffee", "test": "echo \"Error: no test specified\" && exit 1" }, @@ -30,6 +30,7 @@ "sass-loader": "^7.1.0", "style-loader": "^0.23.1", + "nodemon": "^1.18.9", "webpack": "^4.25.1", "webpack-cli": "^3.1.2", diff --git a/server.coffee b/server.coffee index 55da027..e692c7e 100644 --- a/server.coffee +++ b/server.coffee @@ -42,6 +42,7 @@ app.post '/login', (req, res) -> fftcgdb.login req.body.login, req.body.password .then (userid) -> req.session.userID = userid + req.session.userLogin = req.body.login req.session.save() console.log "logged in '#{req.body.login}'" res.json @@ -61,7 +62,7 @@ app.use express.static path.resolve(__dirname, 'public_html') app.set 'view engine', 'pug' app.get '/:template.html', (req, res) -> if req.session - console.log "logged in as '#{req.session.userID}'" + console.log "logged in as '#{req.session.userLogin}'" res.render (req.params.template + '.pug') # Create server