Browse Source

create the level db folder if it does not exists

2015
Jérôme Loï 7 years ago
parent
commit
023d1b039a
  1. 1
      package.json
  2. 9
      server.js

1
package.json

@ -25,6 +25,7 @@
"dependencies": {
"browserify": "^5.11.2",
"domready": "^1.0.7",
"level": "^0.18.0",
"nodemailer": "^1.3.0",
"valid-email": "0.0.1",
"xss-escape": "0.0.5"

9
server.js

@ -9,6 +9,15 @@ var server = require('http').createServer(handler)
, db = require('level')('./db/squatconf', { valueEncoding: 'json' })
, port = process.env.PORT || /*80*/ 8000
// create the level db folder if it does not exists
if(!fs.existsSync('./db/squatconf')){
fs.mkdirSync('./db/squatconf', 0766, function(err){
if(err){
console.log(err);
}
});
}
function handler(req, res) {
// process incoming requests.

Loading…
Cancel
Save