master
iotcat 4 years ago
parent 6873616d14
commit 6ce5ad11ba
  1. 1
      .gitignore
  2. 5
      package.json
  3. 12
      server.js
  4. 1
      utilities/data.js

1
.gitignore vendored

@ -1,2 +1,3 @@
node_modules/ node_modules/
var/ var/
var/

@ -1,13 +1,14 @@
{ {
"name": "todo-ddl", "name": "todo-ddl",
"version": "1.0.1", "version": "1.0.2",
"description": "Todo manager with DDLs..", "description": "Todo manager with DDLs..",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/iotcat/todo-ddl", "repository": "https://github.com/iotcat/todo-ddl",
"author": "iotcat <i@iotcat.me>", "author": "iotcat <i@iotcat.me>",
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
"td": "index.js" "td": "index.js",
"td-server": "server.js"
}, },
"dependencies": { "dependencies": {
"body-parser": "^1.19.0", "body-parser": "^1.19.0",

@ -6,7 +6,17 @@ const find = require(__dirname + '/utilities/find.js')();
app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.urlencoded({ extended: false }));
var data = JSON.parse(fs.readFileSync(__dirname + '/var/data.json'));
var data = {};
fs.exists(__dirname + '/var/data.json', function(exists) {
if(exists){
data = JSON.parse(fs.readFileSync(__dirname + '/var/data.json'));
}else{
fs.mkdir(__dirname + '/var', ()=>{});
}
});
app.listen(13233 /*default port*/, () => console.log('todo-ddl listening on port 13233!')); app.listen(13233 /*default port*/, () => console.log('todo-ddl listening on port 13233!'));

@ -26,6 +26,7 @@ module.exports = () => {
}; };
const conf = new (require('conf'))({ const conf = new (require('conf'))({
projectName: 'todo-ddl',
config: { config: {
type: "object", type: "object",
default: { default: {

Loading…
Cancel
Save