pis #12
8
app.js
8
app.js
@ -5,6 +5,7 @@
|
||||
// different license applies.
|
||||
|
||||
console.log(`Initialising OwlBoard`)
|
||||
const mode = process.env.NODE_ENV || "development"
|
||||
|
||||
// External Requires
|
||||
const express = require('express');
|
||||
@ -38,6 +39,7 @@ const limiter = rateLimit({
|
||||
})
|
||||
|
||||
// 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");
|
||||
|
||||
// Test for required vars:
|
||||
@ -75,6 +77,12 @@ app.use('/api/v1/register', regRtr)
|
||||
app.use('/api/v1/ldbs', authenticate)
|
||||
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
|
||||
app.listen(srvPort, srvListen, (error) =>{
|
||||
if(!error) {
|
||||
|
Loading…
Reference in New Issue
Block a user