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
|
||||
|
||||
// Version Number:
|
||||
var version = "0.0.1"
|
||||
var version = "0.0.1"
|
||||
console.log(`Starting OwlBoard version ${version}`)
|
||||
|
||||
// Load Modules:
|
||||
const fs = require('fs');
|
||||
const ldb = require('ldbs-json');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const fs = require('fs');
|
||||
const ldb = require('ldbs-json');
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
// Get API Keys:
|
||||
try {
|
||||
@ -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
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