Organize old files, add static serving
This commit is contained in:
parent
4116b7a339
commit
f440ec90f7
19
app.js
19
app.js
@ -3,14 +3,14 @@
|
|||||||
// Please see the included LICENSE file
|
// Please see the included LICENSE file
|
||||||
|
|
||||||
// Version Number:
|
// Version Number:
|
||||||
var version = "0.0.1"
|
var version = "0.0.1"
|
||||||
console.log(`Starting OwlBoard version ${version}`)
|
console.log(`Starting OwlBoard version ${version}`)
|
||||||
|
|
||||||
// Load Modules:
|
// Load Modules:
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const ldb = require('ldbs-json');
|
const ldb = require('ldbs-json');
|
||||||
const express = require('express');
|
const express = require('express');
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
// Get API Keys:
|
// Get API Keys:
|
||||||
try {
|
try {
|
||||||
@ -32,7 +32,8 @@ try {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create Web Service:
|
// 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) =>{
|
app.listen(settings.webPort, (error) =>{
|
||||||
if(!error)
|
if(!error)
|
||||||
@ -47,20 +48,20 @@ app.listen(settings.webPort, (error) =>{
|
|||||||
|
|
||||||
// Routes:
|
// Routes:
|
||||||
|
|
||||||
app.get('/', (req, res)=>{
|
app.get('/api', (req, res)=>{
|
||||||
res.status(200);
|
res.status(200);
|
||||||
res.set('Content-Type', 'application/json');
|
res.set('Content-Type', 'application/json');
|
||||||
res.send(JSON.stringify({"OwlBoard_Status":"ready","OwlBoard_Version":version}));
|
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;
|
const {test} = req.body;
|
||||||
res.status(200);
|
res.status(200);
|
||||||
res.set('Content-Type', 'application/json');
|
res.set('Content-Type', 'application/json');
|
||||||
res.send(JSON.stringify({"test_outcome":"success","post_value":test}))
|
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
|
//Check Validity and Auth then return ArrDep JSON
|
||||||
const {reqCode} = req.body;
|
const {reqCode} = req.body;
|
||||||
const {auth} = req.body;
|
const {auth} = req.body;
|
||||||
|
9
static/index.html
Normal file
9
static/index.html
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>OwlBoard</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>OwlBoard</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Reference in New Issue
Block a user