From 43fd6db4b91d92de362a31a6c196c1b60d5177ef Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sun, 11 Jun 2023 19:42:39 +0100 Subject: [PATCH] Prepare for LDBSV --- UpNext.md | 4 ---- app.js | 12 +++++++----- ...{ldbs.controllers copy.js => ldbs.controllers.js} | 0 3 files changed, 7 insertions(+), 9 deletions(-) delete mode 100644 UpNext.md rename src/controllers/{ldbs.controllers copy.js => ldbs.controllers.js} (100%) diff --git a/UpNext.md b/UpNext.md deleted file mode 100644 index c7a1fe3..0000000 --- a/UpNext.md +++ /dev/null @@ -1,4 +0,0 @@ -# What to do next: - -* Rewrite sanitizing functions to remove external dependancy. -* Change /api/v1/auth endpoints to /api/v1/register endpoints - auth is done in middleware \ No newline at end of file diff --git a/app.js b/app.js index 76893ba..89604f3 100644 --- a/app.js +++ b/app.js @@ -4,8 +4,6 @@ // licensed separately, each folder contains a license file where a // different license applies. -/* global process */ - console.log('Initialising OwlBoard'); const mode = process.env.NODE_ENV || 'development'; @@ -23,6 +21,7 @@ const log = require('./src/utils/log.utils'); const version = require('./src/configs/version.configs'); const listRtr = require('./src/routes/list.routes'); const ldbRtr = require('./src/routes/ldb.routes'); +const ldbsRtr = require('./src/routes/ldbs.routes'); const kubeRtr = require('./src/routes/kube.routes'); const findRtr = require('./src/routes/find.routes'); const issueRtr = require('./src/routes/issue.routes'); @@ -79,10 +78,13 @@ app.use('/api/v1/stats', statRtr); app.use('/api/v1/register', regRtr); // Authented Routes -app.use('/api/v1/ldbs', authenticate, (req, res) => res.status(501).json({status: 'not implemented'})); +app.use('/api/v1/ldbs', authenticate, ldbsRtr); app.use('/api/v1/pis', authenticate, pisRtr); -app.use('/api/v1/auth/test', authenticate, (req, res) => res.status(200).json({status: 'ok', message: 'Authentication successful'})); // Returns 401 if auth failed, 200 if successful. -app.use('/api/v1/train', /*authenticate,*/ trainRtr); // Disable authentication during testing +app.use('/api/v1/auth/test', authenticate, (req, res) => res.status(200).json({ + status: 'ok', + message: 'Authentication successful' +})); // Returns 401 if auth failed, 200 if successful. +app.use('/api/v1/train', authenticate, trainRtr); // Number of proxies: app.set('trust proxy', 4); diff --git a/src/controllers/ldbs.controllers copy.js b/src/controllers/ldbs.controllers.js similarity index 100% rename from src/controllers/ldbs.controllers copy.js rename to src/controllers/ldbs.controllers.js