diff options
| author | Pitu <[email protected]> | 2017-01-13 04:34:21 -0300 |
|---|---|---|
| committer | Pitu <[email protected]> | 2017-01-13 04:34:21 -0300 |
| commit | 376cf10663f76d99721ee8596634488868482606 (patch) | |
| tree | 28774ab842a044e571a31b7612311ef1a339be48 /lolisafe.js | |
| parent | Initial commit (diff) | |
| download | host.fuwn.me-376cf10663f76d99721ee8596634488868482606.tar.xz host.fuwn.me-376cf10663f76d99721ee8596634488868482606.zip | |
First version
Diffstat (limited to 'lolisafe.js')
| -rw-r--r-- | lolisafe.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lolisafe.js b/lolisafe.js new file mode 100644 index 0000000..f99df78 --- /dev/null +++ b/lolisafe.js @@ -0,0 +1,31 @@ +const config = require('./config.js') +const routes = require('./routes.js') +const express = require('express') +const db = require('knex')(config.database) +const fs = require('fs') +const safe = express() + +fs.existsSync('./' + config.uploads.folder) || fs.mkdirSync('./' + config.uploads.folder) +fs.existsSync('./' + config.logsFolder) || fs.mkdirSync('./' + config.logsFolder) +fs.existsSync('db') || fs.writeFile('db', '') + +safe.use('/', express.static('./uploads')) +safe.use('/api' , routes) +safe.use('/panel', express.static('./dashboard')) + +// Create the tables we need to store galleries and files +db.schema.createTableIfNotExists('gallery', function (table) { + table.increments() + table.string('name') + table.timestamps() +}).then(() => {}) + +db.schema.createTableIfNotExists('files', function (table) { + table.increments() + table.string('file') + table.integer('galleryid') +}).then(() => {}) + +safe.enable('trust proxy') + +safe.listen(config.port, () => console.log(`loli-safe started on port ${config.port}`))
\ No newline at end of file |