From dbf93d8d1fb1cc399c0ee73882ca7b8a29a0bcb8 Mon Sep 17 00:00:00 2001 From: choelzl Date: Fri, 16 Jul 2021 12:02:23 +0200 Subject: [PATCH] fixes --- auth_db.js | 36 ------------------------------------ package.json | 8 ++++---- server.js | 6 +----- 3 files changed, 5 insertions(+), 45 deletions(-) delete mode 100644 auth_db.js diff --git a/auth_db.js b/auth_db.js deleted file mode 100644 index a8c1024..0000000 --- a/auth_db.js +++ /dev/null @@ -1,36 +0,0 @@ -'use strict' - -const fp = require('fastify-plugin') -const levelup = require('levelup') -const leveldown = require('leveldown') -const encode = require('encoding-down') - -// mostly from level-packager -const levelMore = (location) => { - ;['destroy', 'repair'].forEach(function (m) { - if (typeof leveldown[m] === 'function') { - levelMore[m] = () => leveldown[m].apply(leveldown, arguments) - } - }) - - return levelup(encode(leveldown(location), { }), { }) -} - -levelMore.errors = levelup.errors - -function levelPlugin (fastify, opt, next) { - fastify - .decorate('lauth', levelMore('auth')) - .addHook('onClose', close) - - next() -} - -function close (fastify, done) { - fastify.level.close(done) -} - -module.exports = fp(levelPlugin, { - fastify: '>=1.0.0', - name: 'level_auth' -}); \ No newline at end of file diff --git a/package.json b/package.json index 20da110..7247d99 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,11 @@ "author": "", "license": "ISC", "dependencies": { - "axios": "^0.21.1", + "axios": "latest", "fastify": "latest", "fastify-leveldb": "latest", - "fastify-static": "^2.5.0", - "mkdirp": "^1.0.4", - "node-sass": "^6.0.0" + "fastify-static": "latest", + "mkdirp": "latest", + "node-sass": "latest" } } diff --git a/server.js b/server.js index 8e983df..1aa2775 100644 --- a/server.js +++ b/server.js @@ -20,10 +20,7 @@ fastify.register(require('fastify-leveldb'), { fastify.get('/', (req, reply) => { reply.sendFile('/template/home.html'); }); - -fastify.get('/dbg', (req, reply) => { - reply.sendFile('/template/templates.html'); -}); +fastify.register(require('./router/api'), { prefix: '/api' }); fastify.get('/:id', (req, reply) => { try{ @@ -49,7 +46,6 @@ fastify.get('/:id', (req, reply) => { }); -fastify.register(require('./router/api'), { prefix: '/api' }); fastify.listen(8080,'0.0.0.0' ,(err,address) => {