Node.js based forum software built for the modern web
small refactor to install/web.js
psychobunny20a1ab185c93
diff --git a/install/web.js b/install/web.jsindex 515a4fe7b6..f87c4d024d 100644--- a/install/web.js+++ b/install/web.js@@ -2,6 +2,7 @@var winston = require('winston'),express = require('express'),+ bodyParser = require('body-parser'),fs = require('fs'),path = require('path'),less = require('less'),@@ -24,6 +25,14 @@ web.install = function(port) {port = port || 8080;winston.info('Launching web installer on port ', port);+ app.use(express.static('public', {}));+ app.engine('tpl', require('templates.js').__express);+ app.set('view engine', 'tpl');+ app.set('views', path.join(__dirname, '../src/views'));+ app.use(bodyParser.urlencoded({+ extended: true+ }));+async.parallel([compileLess, compileJS], function() {setupRoutes();launchExpress(port);@@ -32,11 +41,6 @@ web.install = function(port) {function launchExpress(port) {- app.use(express.static('public', {}));- app.engine('tpl', require('templates.js').__express);- app.set('view engine', 'tpl');- app.set('views', path.join(__dirname, '../src/views'));-var server = app.listen(port, function() {var host = server.address().address;winston.info('Web installer listening on http://%s:%s', host, port);@@ -44,10 +48,11 @@ function launchExpress(port) {}function setupRoutes() {- app.get('/', install);+ app.get('/', welcome);+ app.post('/', install);}-function install(req, res, next) {+function welcome(req, res) {var dbs = ['redis', 'mongo'],databases = [];@@ -63,6 +68,10 @@ function install(req, res, next) {});}+function install(req, res) {+ console.log(req.body);+}+function compileLess(callback) {fs.readFile(path.join(__dirname, '../public/less/install.less'), function(err, style) {less.render(style.toString(), function(err, css) {diff --git a/src/views/install/index.tpl b/src/views/install/index.tplindex 0901f5fdab..26286a6a8f 100644--- a/src/views/install/index.tpl+++ b/src/views/install/index.tpl@@ -47,7 +47,7 @@<h1>Welcome to the NodeBB Installer</h1>You are just a few steps away from launching your own NodeBB forum!</p>- <form>+ <form action="/" method="post"><p><h1><small>Create an Administrator account</small></h1><hr />@@ -97,6 +97,8 @@</div><div id="database-config"></div>++ <button type="submit" class="btn btn-lg btn-success">Install NodeBB</button></form></div>