pis #12

Merged
fred.boniface merged 95 commits from pis into main 2023-05-06 21:54:51 +01:00
Showing only changes of commit 9c45ecfdf1 - Show all commits

8
app.js
View File

@ -5,6 +5,7 @@
// different license applies. // different license applies.
console.log(`Initialising OwlBoard`) console.log(`Initialising OwlBoard`)
const mode = process.env.NODE_ENV || "development"
// External Requires // External Requires
const express = require('express'); const express = require('express');
@ -38,6 +39,7 @@ const limiter = rateLimit({
}) })
// Print version number: // Print version number:
log.out(`app: Starting OwlBoard in ${mode} mode`, "init")
log.out(`app: Starting OwlBoard - Backend Version: ${version.app} - API versions: ${version.api}`, "init"); log.out(`app: Starting OwlBoard - Backend Version: ${version.app} - API versions: ${version.api}`, "init");
// Test for required vars: // Test for required vars:
@ -75,6 +77,12 @@ app.use('/api/v1/register', regRtr)
app.use('/api/v1/ldbs', authenticate) app.use('/api/v1/ldbs', authenticate)
app.use('/api/v1/auth/test', authenticate) // Returns 401 if auth failed, 404 if successful. app.use('/api/v1/auth/test', authenticate) // Returns 401 if auth failed, 404 if successful.
// Number of proxies:
app.set('trust proxy', 3)
mode === "development"
? app.get('/api/v1/ip', (request, response) => response.send(request.ip))
: null
// Start Express // Start Express
app.listen(srvPort, srvListen, (error) =>{ app.listen(srvPort, srvListen, (error) =>{
if(!error) { if(!error) {