pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
3 changed files with 26 additions and 0 deletions
Showing only changes of commit 121528c413 - Show all commits

2
app.js
View File

@ -26,6 +26,7 @@ const findRtr = require('./src/routes/find.routes'); // /find endpoint
const issueRtr = require('./src/routes/issue.routes'); // /issue endpoints
const statRtr = require('./src/routes/stats.routes'); // /stat endpoints
const regRtr = require('./src/routes/registration.routes'); // /registration endpoints
const pisRtr = require('./src/routes/pis.routes'); // /pis endpoints
// Set Server Configurations
const srvListen = process.env.OWL_SRV_LISTEN || "0.0.0.0"
@ -72,6 +73,7 @@ app.use('/api/v1/find', findRtr);
app.use('/api/v1/issue', issueRtr);
app.use('/api/v1/stats', statRtr);
app.use('/api/v1/register', regRtr);
app.use('/api/v1/pis', pisRtr)
// Authented Routes
app.use('/api/v1/ldbs', authenticate)

View File

@ -0,0 +1,17 @@
const pis = require('../services/pis.services');
async function byOrigDest(req, res, next){
try {
let start = req.params.start
let end = req.params.end
res.json(await pis.findPisByOrigDest(start,end))
} catch (err) {
console.error(`Unknown Error`, err.message);
next(err);
}
}
module.exports = {
byOrigDest
}

7
src/routes/pis.routes.js Normal file
View File

@ -0,0 +1,7 @@
const express = require('express');
const router = express.Router();
const pisController = require('../controllers/pis.controllers');
router.get('/origdest/:start/:end', pisController.byOrigDest);
module.exports = router;