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ï 10 years ago
parent f38f3baf92
commit ce9282f04b

1
.gitignore vendored

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

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

@ -1,43 +1,15 @@
#!/usr/bin/env node #!/usr/bin/env node
var fs = require('fs') var ecstatic = require('ecstatic')
, http = require('http') , app = require('http').createServer(
, stack = require('stack') ecstatic({ root: __dirname + '/public' })
, route = require('tiny-route') ).listen(8000)
, 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 })
)
process.on('uncaughtException', function (err) { process.on('uncaughtException', function (err) {
console.error('Error at:', new Date) console.error('Error at:', new Date)
console.error(err.stack) 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