diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..5765312 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: coffee web.coffee diff --git a/package.json b/package.json index 6eebe86..fea0876 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "dependencies": { "coffee-script": "*", "flatiron": "*", + "union": "*", "csv": "*", "async": "*", "node-zip": "*", diff --git a/web.coffee b/web.coffee new file mode 100644 index 0000000..a435e36 --- /dev/null +++ b/web.coffee @@ -0,0 +1,25 @@ +flatiron = require 'flatiron' +dbToJson = require('./lib/lib').dbToJson +Location = require('./lib/models').Location + +app = flatiron.app + +app.use flatiron.plugins.http, {} + +app.config.env() +app.config.defaults({ + 'MONGOHQ_URL': 'mongodb://localhost:27017/waterstanden-dev' +}) + +Location.connect(app.config.get('MONGOHQ_URL')) + +read = -> + dbToJson (error, json) => + Location.db.close() + @res.writeHead(200, {'Content-Type': 'application/json'}) + @res.write JSON.stringify(json) + @res.end() + +port = process.env.PORT || 5000 +app.router.get '/', read +app.listen(port)