Compare commits
No commits in common. "faeeddac359fefcc20a26c4e28ba6e24f6a8e97d" and "07d281a56b9154285b9efc1714f6bb5dbd43fe28" have entirely different histories.
faeeddac35
...
07d281a56b
|
@ -24,10 +24,10 @@
|
||||||
* DB Indexes:
|
* DB Indexes:
|
||||||
- "stations": 3ALPHA, STANOX, TIPLOC
|
- "stations": 3ALPHA, STANOX, TIPLOC
|
||||||
- "corpus": 3ALPHA, NLC
|
- "corpus": 3ALPHA, NLC
|
||||||
* DB Indexes:.
|
|
||||||
- "corpus": NLCDESC(TEXT)
|
|
||||||
|
|
||||||
## Backend:
|
## Backend:
|
||||||
|
|
||||||
|
* DB Indexes:.
|
||||||
|
- "corpus": NLCDESC(TEXT)
|
||||||
* Rewrite sanitizing functions to remove external dependancy.
|
* Rewrite sanitizing functions to remove external dependancy.
|
||||||
* Undo changed to make everything an array - frontend code to handle this.
|
* Undo changed to make everything an array - frontend code to handle this.
|
2
app.js
2
app.js
|
@ -20,7 +20,6 @@ const ldbRtr = require('./src/routes/ldb.routes'); // /ldb endpoints
|
||||||
const kubeRtr = require('./src/routes/kube.routes'); // /kube endpoints
|
const kubeRtr = require('./src/routes/kube.routes'); // /kube endpoints
|
||||||
const findRtr = require('./src/routes/find.routes'); // /find endpoints
|
const findRtr = require('./src/routes/find.routes'); // /find endpoints
|
||||||
const issueRtr = require('./src/routes/issue.routes') // /issue endpoints
|
const issueRtr = require('./src/routes/issue.routes') // /issue endpoints
|
||||||
const statRtr = require('./src/routes/stats.routes'); // /stat endpoints
|
|
||||||
const initDb = require('./src/utils/dbinit.utils'); // DB Init Utility
|
const initDb = require('./src/utils/dbinit.utils'); // DB Init Utility
|
||||||
|
|
||||||
// Set Server Configurations
|
// Set Server Configurations
|
||||||
|
@ -60,7 +59,6 @@ app.use('/api/v1/ldb', ldbRtr);
|
||||||
app.use('/api/v1/kube', kubeRtr);
|
app.use('/api/v1/kube', kubeRtr);
|
||||||
app.use('/api/v1/find', findRtr);
|
app.use('/api/v1/find', findRtr);
|
||||||
app.use('/api/v1/issue', issueRtr);
|
app.use('/api/v1/issue', issueRtr);
|
||||||
app.use('/api/v1/stats', statRtr)
|
|
||||||
|
|
||||||
// Start Express
|
// Start Express
|
||||||
app.listen(srvPort, srvListen, (error) =>{
|
app.listen(srvPort, srvListen, (error) =>{
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
const stat = require('../services/stats.services');
|
|
||||||
|
|
||||||
async function get(req, res, next) {
|
|
||||||
try {
|
|
||||||
res.json(await stat.hits())
|
|
||||||
} catch (err) {
|
|
||||||
console.error(`Controller Error`, err);
|
|
||||||
next(err);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
get}
|
|
|
@ -16,5 +16,6 @@ const listController = require('../controllers/list.controllers');
|
||||||
|
|
||||||
router.get('/stations', listController.getStations);
|
router.get('/stations', listController.getStations);
|
||||||
router.get('/corpus', listController.getCorpus);
|
router.get('/corpus', listController.getCorpus);
|
||||||
|
router.get('/hits', listController.hits)
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
|
@ -1,8 +0,0 @@
|
||||||
const express = require('express');
|
|
||||||
const router = express.Router();
|
|
||||||
const statsController = require('../controllers/stats.controllers');
|
|
||||||
|
|
||||||
|
|
||||||
router.get('/', statsController.get);
|
|
||||||
|
|
||||||
module.exports = router;
|
|
|
@ -29,7 +29,7 @@ async function get() {
|
||||||
async function fetch() {
|
async function fetch() {
|
||||||
log.out("corpus.fetch: Fetching CORPUS Data from Network Rail")
|
log.out("corpus.fetch: Fetching CORPUS Data from Network Rail")
|
||||||
authHead = Buffer.from(`${corpusUser}:${corpusPass}`).toString('base64')
|
authHead = Buffer.from(`${corpusUser}:${corpusPass}`).toString('base64')
|
||||||
const url = 'https://publicdatafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS'
|
const url = 'https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS'
|
||||||
const options = {
|
const options = {
|
||||||
method: 'get',
|
method: 'get',
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
|
|
|
@ -14,7 +14,17 @@ async function getCorpus(){
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function hits(){
|
||||||
|
var dat = await db.query("meta", {target: "counters"});
|
||||||
|
log.out(`listServices.meta: fetched server meta`)
|
||||||
|
let out = {}
|
||||||
|
out.host = os.hostname()
|
||||||
|
out.dat = dat
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getStations,
|
getStations,
|
||||||
getCorpus
|
getCorpus,
|
||||||
|
hits
|
||||||
}
|
}
|
|
@ -1,16 +0,0 @@
|
||||||
const log = require('../utils/log.utils'); // Log Helper
|
|
||||||
const db = require('../services/dbAccess.services')
|
|
||||||
const os = require('os')
|
|
||||||
|
|
||||||
async function hits(){
|
|
||||||
var dat = await db.query("meta", {target: "counters"});
|
|
||||||
log.out(`listServices.meta: fetched server meta`)
|
|
||||||
let out = {}
|
|
||||||
out.host = os.hostname()
|
|
||||||
out.dat = dat
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
hits
|
|
||||||
}
|
|
|
@ -39,7 +39,7 @@ http {
|
||||||
proxy_pass http://localhost:8460;
|
proxy_pass http://localhost:8460;
|
||||||
proxy_cache_key $scheme://$host$uri$is_args$query_string;
|
proxy_cache_key $scheme://$host$uri$is_args$query_string;
|
||||||
proxy_ignore_headers Cache-Control;
|
proxy_ignore_headers Cache-Control;
|
||||||
proxy_cache_valid 200 2m; # Evaluate whether 2m or 1m is more appropriate
|
proxy_cache_valid 200 20m; # Change to 1m for release.
|
||||||
gzip on;
|
gzip on;
|
||||||
brotli on;
|
brotli on;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer>
|
<footer>
|
||||||
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - 0.0.1-dev-2023020201</p>
|
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - 0.0.1-dev-2023013109</p>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -5,7 +5,7 @@ async function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get() {
|
async function get() {
|
||||||
var url = `${window.location.origin}/api/v1/stats`;
|
var url = `${window.location.origin}/api/v1/list/hits`;
|
||||||
var resp = await fetch(url);
|
var resp = await fetch(url);
|
||||||
return await resp.json();
|
return await resp.json();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Service Worker */
|
/* Service Worker */
|
||||||
|
|
||||||
const appVersion = "0.0.1-dev-2023020201"
|
const appVersion = "0.0.1-dev-2023013109"
|
||||||
const cacheName = `owlboard-${appVersion}`
|
const cacheName = `owlboard-${appVersion}`
|
||||||
const cacheIDs = [cacheName]
|
const cacheIDs = [cacheName]
|
||||||
const cacheFiles = [
|
const cacheFiles = [
|
||||||
|
|
Reference in New Issue