1
0
Fork 0

cleaning old info, rework main text of the website, begin removing the old db system

release/1.2.0
Jérôme Loï 9 years ago
parent f38f3baf92
commit ce9282f04b

1
.gitignore vendored

@ -19,3 +19,4 @@ html/assets/js/email*
/config.json
config.js
mails.txt

@ -1,6 +1,6 @@
{
"name": "squatconf-web",
"version": "1.1.1",
"version": "1.2.0",
"description": "website for the squatConf conference",
"main": "server.js",
"scripts": {

@ -1,43 +1,15 @@
#!/usr/bin/env node
var fs = require('fs')
, http = require('http')
, stack = require('stack')
, route = require('tiny-route')
, assets = require('ecstatic')
, config = require('./config')
, db = require('level')(config.db_path, config.db_opts)
, port = process.env.PORT || config.port
// create the level db folder if it does not exists
if(!fs.existsSync(config.db_path)){
fs.mkdirSync(config.db_path, 0766, function(err){
if(err){
console.log(err);
}
});
}
stack.errorHandler = function error(req, res, err) {
res.statusCode = 302
res.setHeader('Location', '/')
res.end()
}
var app = stack(
route('/email', require('./src/email-submit')(db))
, route('/confirm', require('./src/email-confirm')(db))
, assets({ root: __dirname +'/html', handleError: false })
)
var ecstatic = require('ecstatic')
, app = require('http').createServer(
ecstatic({ root: __dirname + '/public' })
).listen(8000)
;
process.on('uncaughtException', function (err) {
console.error('Error at:', new Date)
console.error(err.stack)
})
http.createServer(app).listen(port, function() {
console.log('[PID='+ process.pid +'] server started on port '+ port)
console.log('(use Ctrl+c to stop the server)')
})

Loading…
Cancel
Save