Remove /test endpoint. Update readme
This commit is contained in:
parent
c2c04cee12
commit
cc2895bf40
34
README.md
34
README.md
@ -22,37 +22,39 @@ To run this server you will need:
|
||||
|
||||
## API Endpoints:
|
||||
- /api/v1:
|
||||
- /test:
|
||||
- GET: Check your connection with the server
|
||||
- If `Authentication: Basic` header is provided your key will be checked, if not then just the conenction will be tested.
|
||||
|
||||
- /list:
|
||||
- GET: Get list of stations
|
||||
- Request Header - Basic Auth -- Not Currently Implemented/Required on this route
|
||||
- Returns JSON: `{"STATION NAME":{"CRS":"code","TIPLOC":"code"}}`
|
||||
- /stations:
|
||||
- GET: Get list of stations
|
||||
- Authenticated: No
|
||||
- Returns JSON: `{"STATION NAME":{"CRS":"code","TIPLOC":"code"}}`
|
||||
|
||||
- /all:
|
||||
- /corpus:
|
||||
- GET: Get full CORPUS Data
|
||||
- Returns JSON in original CORPUS format minus any blank values.
|
||||
- Authenticated: No
|
||||
- Returns JSON in original CORPUS format minus any blank values.
|
||||
|
||||
- /ldb:
|
||||
- /{crs}:
|
||||
- GET: Get arrival/departure board for {crs}
|
||||
- Request Header - Basic Auth -- Not Currently Implemented/Required on this route
|
||||
- Authenticated: No
|
||||
- Returns JSON: Formatted as per ldbs-json module.
|
||||
|
||||
- /gitea:
|
||||
- POST: Post issue to Gitea Repo
|
||||
- Authenticated: Yes
|
||||
- Not yet implemented, submit issues at https://git.fjla.uk/fred.boniface/owlboard
|
||||
|
||||
- /api/kube:
|
||||
- /alive:
|
||||
- GET: Check alive
|
||||
- Returns JSON: `{"status":"alive"}`
|
||||
- /kube:
|
||||
- /alive:
|
||||
- GET: Check alive
|
||||
- Authenticated: No
|
||||
- Returns JSON: `{"status":"alive"}`
|
||||
|
||||
- /ready:
|
||||
- GET: Check ready
|
||||
- Returns JSON: `{"state":""}` ready or not_ready.
|
||||
- /ready:
|
||||
- GET: Check ready
|
||||
- Authenticated: No
|
||||
- Returns JSON: `{"state":""}` ready or not_ready.
|
||||
|
||||
## Stack:
|
||||
- app.js -> Launches server, Entry Point, defines routers and middlewares.
|
||||
|
1
app.js
1
app.js
@ -44,7 +44,6 @@ app.use(express.json()); //JSON Parsing for POST Requests
|
||||
app.use(express.static('static')); //Serve static content from /static
|
||||
|
||||
// Express Routes
|
||||
app.use('/api/v1/test', testRtr);
|
||||
app.use('/api/v1/list', listRtr);
|
||||
app.use('/api/v1/ldb', ldbRtr);
|
||||
app.use('/api/v1/kube', kubeRtr);
|
||||
|
@ -1,25 +0,0 @@
|
||||
const test = require('../services/test.services');
|
||||
|
||||
async function get(req, res, next){
|
||||
try {
|
||||
res.json(await test.get(req.body))
|
||||
} catch (err) {
|
||||
console.error(`Unknown Error`, err.message);
|
||||
next(err);
|
||||
}
|
||||
}
|
||||
|
||||
async function post(req, res){
|
||||
// try { checkAuth(req.body) } catch (err) { req.header(401); req.body({401:"unauthorised"})}
|
||||
try {
|
||||
res.json(await test.post(req.body))
|
||||
} catch (err) {
|
||||
console.error(`Unknown Error`, err.message);
|
||||
next(err);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
post
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const testController = require('../controllers/test.controllers');
|
||||
|
||||
router.get('/', testController.get);
|
||||
router.post('/', testController.post);
|
||||
|
||||
module.exports = router;
|
@ -1,20 +0,0 @@
|
||||
// Get CORPUS data from Network Rail and format the data for OwlBoard
|
||||
|
||||
// FUNCTIONS
|
||||
// get() : Exported: Returns: Ready Status and Owlboard Version
|
||||
// post() : Exported: Will check the API authentication and return status
|
||||
|
||||
const version = require('../configs/version.configs');
|
||||
|
||||
async function get(){
|
||||
return {"OwlBoard_Status":"ready","OwlBoard_Version":version};
|
||||
}
|
||||
|
||||
async function post(){
|
||||
return {"type":"post"};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
get,
|
||||
post
|
||||
}
|
Reference in New Issue
Block a user