pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
6 changed files with 29 additions and 2 deletions
Showing only changes of commit dd96e95ce5 - Show all commits

View File

@ -1,3 +1,4 @@
# What to do next: # What to do next:
* Rewrite sanitizing functions to remove external dependancy. * Rewrite sanitizing functions to remove external dependancy.
* Change /api/v1/auth endpoints to /api/v1/register endpoints - auth is done in middleware

View File

@ -23,6 +23,7 @@ async function getTime(req, res, next){
res.json(await kube.getTime(req.body)) res.json(await kube.getTime(req.body))
} catch (err) { } catch (err) {
console.error(`Unknown Error`, err.message); console.error(`Unknown Error`, err.message);
err.status = 503
next(err); next(err);
} }
} }

View File

@ -6,6 +6,7 @@ async function get(req, res, next){
res.json(await ldb.get(req.body, id)) res.json(await ldb.get(req.body, id))
} catch (err) { } catch (err) {
console.error(`Unknown Error`, err.message); console.error(`Unknown Error`, err.message);
err.status = 500
next(err); next(err);
} }
} }

View File

@ -5,6 +5,7 @@ async function getStations(req, res, next){
res.json(await list.getStations(req.body)) res.json(await list.getStations(req.body))
} catch (err) { } catch (err) {
console.error(`Controller Error`, err.message); console.error(`Controller Error`, err.message);
err.status = 500
next(err); next(err);
} }
} }
@ -14,6 +15,7 @@ async function getCorpus(req, res, next){
res.json(await list.getCorpus(req.body)) res.json(await list.getCorpus(req.body))
} catch (err) { } catch (err) {
console.error(`Controller Error`, err.message); console.error(`Controller Error`, err.message);
err.status = 500
next(err); next(err);
} }
} }
@ -23,6 +25,7 @@ async function hits(req, res, next) {
res.json(await list.hits()) res.json(await list.hits())
} catch (err) { } catch (err) {
console.error(`Controller Error`, err); console.error(`Controller Error`, err);
err.status = 500
next(err); next(err);
} }
} }

View File

@ -5,9 +5,11 @@ async function get(req, res, next) {
res.json(await stat.hits()) res.json(await stat.hits())
} catch (err) { } catch (err) {
console.error(`Controller Error`, err); console.error(`Controller Error`, err);
err.status = 500
next(err); next(err);
} }
} }
module.exports = { module.exports = {
get} get
}

19
src/routes/ldbs.routes.js Normal file
View File

@ -0,0 +1,19 @@
const express = require('express');
const router = express.Router();
const ldbController = require('../controllers/ldb.controllers');
/* GET programming languages. */
//router.get('/', programmingLanguagesController.get);
/* POST programming language */
//router.post('/', programmingLanguagesController.create);
/* PUT programming language */
//router.put('/:id', programmingLanguagesController.update);
/* DELETE programming language */
//router.delete('/:id', programmingLanguagesController.remove);
router.get('/:id', ldbController.get);
module.exports = router;