Node.js based forum software built for the modern web
installer - got the basics in
psychobunny60d655e32b23
diff --git a/Gruntfile.js b/Gruntfile.jsindex 551d8d7ed3..5820b1565f 100644--- a/Gruntfile.js+++ b/Gruntfile.js@@ -60,7 +60,7 @@ module.exports = function(grunt) {files: ['public/src/**/*.js', 'node_modules/nodebb-*/*.js', 'node_modules/nodebb-*/*/*.js', 'node_modules/nodebb-*/*/*/*.js', 'node_modules/nodebb-*/*/*/*/*.js']},serverUpdated: {- files: ['*.js', 'src/**/*.js']+ files: ['*.js', 'install/*.js', 'src/**/*.js']},templatesUpdated: {files: ['src/views/**/*.tpl', 'node_modules/nodebb-*/*.tpl', 'node_modules/nodebb-*/*/*.tpl', 'node_modules/nodebb-*/*/*/*.tpl', 'node_modules/nodebb-*/*/*/*/*.tpl', 'node_modules/nodebb-*/*/*/*/*/*.tpl']diff --git a/app.js b/app.jsindex 3e947becbd..68ffe6faea 100644--- a/app.js+++ b/app.js@@ -68,7 +68,7 @@ if (!nconf.get('setup') && !nconf.get('install') && !nconf.get('upgrade') && !nc} else if (nconf.get('setup') || nconf.get('install')) {setup();} else if (!configExists) {- require('./install/web').install();+ require('./install/web').install(nconf.get('port'));} else if (nconf.get('upgrade')) {upgrade();} else if (nconf.get('reset')) {diff --git a/install/web.js b/install/web.jsindex 773754af83..4b9b19ce03 100644--- a/install/web.js+++ b/install/web.js@@ -1,11 +1,42 @@"use strict";+var winston = require('winston'),+ express = require('express'),+ nconf = require('nconf'),+ path = require('path'),+ app = express();+var web = {};-web.install = function() {+web.install = function(port) {+ port = port || 8080;+ winston.info('Launching web installer on port ', port);+ setupRoutes();+ launchExpress(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);+ });+}++function setupRoutes() {+ app.get('/', install);+}++function install(req, res, next) {+ console.log('test');+ res.render('install/index', {});+}+module.exports = web;\ No newline at end of filediff --git a/src/views/install/index.tpl b/src/views/install/index.tplnew file mode 100644index 0000000000..69ffdfe478--- /dev/null+++ b/src/views/install/index.tpl@@ -0,0 +1 @@+Welcome to the installer!\ No newline at end of file