Organize old files, add static serving

This commit is contained in:
Fred Boniface 2022-11-30 14:32:36 +00:00
parent 4116b7a339
commit f440ec90f7
3 changed files with 19 additions and 9 deletions

9
app.js
View File

@ -32,7 +32,8 @@ try {
};
// Create Web Service:
app.use(express.json());
app.use(express.json()); //JSON Parsing for POST Requests
app.use(express.static('static')); //Serve static content from static
app.listen(settings.webPort, (error) =>{
if(!error)
@ -47,20 +48,20 @@ app.listen(settings.webPort, (error) =>{
// Routes:
app.get('/', (req, res)=>{
app.get('/api', (req, res)=>{
res.status(200);
res.set('Content-Type', 'application/json');
res.send(JSON.stringify({"OwlBoard_Status":"ready","OwlBoard_Version":version}));
});
app.post('/test', (req, res)=>{
app.post('/api/test', (req, res)=>{
const {test} = req.body;
res.status(200);
res.set('Content-Type', 'application/json');
res.send(JSON.stringify({"test_outcome":"success","post_value":test}))
})
app.post('/arrdep', (req, res)=>{
app.post('/api/arrdep', (req, res)=>{
//Check Validity and Auth then return ArrDep JSON
const {reqCode} = req.body;
const {auth} = req.body;

9
static/index.html Normal file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>OwlBoard</title>
</head>
<body>
<h1>OwlBoard</h1>
</body>
</html>