diff --git a/README.md b/README.md index 409937f..60acdea 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,12 @@ create directory for database ``` mkdir data ``` -configure same base path on +configure same base path [at least '/'] on - src/client/src/config.json - src/config/server.json - src/config/op.json + compile and build the client ``` cd client && npm i && npm run build && cd .. diff --git a/src/client/src/config.json b/src/client/src/config.json index 007e781..0bd24df 100644 --- a/src/client/src/config.json +++ b/src/client/src/config.json @@ -1,3 +1,3 @@ { - "basepath": "/oidc/rp/" -} + "basepath": "/oidc/rp/" +} diff --git a/src/client/src/containers/Main/Main.js b/src/client/src/containers/Main/Main.js index d99f930..26e118e 100644 --- a/src/client/src/containers/Main/Main.js +++ b/src/client/src/containers/Main/Main.js @@ -192,7 +192,7 @@ class Main extends Component {
- + diff --git a/src/client/src/services.js b/src/client/src/services.js index 175cc6a..d2a24a6 100644 --- a/src/client/src/services.js +++ b/src/client/src/services.js @@ -19,7 +19,7 @@ class MainService { login(options, callback_response, callback_error) { Utility.log("GET /login"); - axios.get(config.basepath + '/login?user=' + options.user + '&password=' + options.password) + axios.get(config.basepath + 'login?user=' + options.user + '&password=' + options.password) .then((response)=> { callback_response(response.data.apikey); }) @@ -30,7 +30,7 @@ class MainService { assert(callback_response, callback_error) { Utility.log("GET /login/assert"); - axios.get(config.basepath + '/login/assert') + axios.get(config.basepath + 'login/assert') .then((response)=> { callback_response(response.data); }) @@ -56,7 +56,7 @@ class MainService { getInfo(callback_response, callback_nosession, callback_error) { Utility.log("GET /api/info"); - axios.get(config.basepath + '/api/info?apikey=' + Utility.getApikey()) + axios.get(config.basepath + 'api/info?apikey=' + Utility.getApikey()) .then(function(response) { Utility.log("getInfo Success", response.data); if(response.data.metadata.configuration && response.data.request) { @@ -73,7 +73,7 @@ class MainService { loadAllWorkspace(callback_response, callback_nosession, callback_error) { Utility.log("GET /api/stores?apikey=" + Utility.getApikey()); - axios.get(config.basepath + '/api/stores?apikey=' + Utility.getApikey()) + axios.get(config.basepath + 'api/stores?apikey=' + Utility.getApikey()) .then(function(response) { Utility.log("loadAllWorkspace Success", response.data); callback_response(response.data); @@ -90,7 +90,7 @@ class MainService { loadWorkspace(store_type, callback_response, callback_nosession, callback_error) { Utility.log("GET /api/store?store_type=" + store_type + "&apikey=" + Utility.getApikey()); - axios.get(config.basepath + '/api/store?store_type=' + store_type + '&apikey=' + Utility.getApikey()) + axios.get(config.basepath + 'api/store?store_type=' + store_type + '&apikey=' + Utility.getApikey()) .then(function(response) { Utility.log("loadWorkspace Success", response.data); callback_response(response.data); @@ -106,7 +106,7 @@ class MainService { saveWorkspace(data) { Utility.log("POST /api/store", data); - axios.post(config.basepath + '/api/store?apikey=' + Utility.getApikey(), data) + axios.post(config.basepath + 'api/store?apikey=' + Utility.getApikey(), data) .then(function(response) { Utility.log("saveWorkspace Success", response.data); }) @@ -117,7 +117,7 @@ class MainService { resetWorkspace(store_type, callback_response, callback_error) { Utility.log("DELETE /api/store?store_type=" + store_type); - axios.delete(config.basepath + '/api/store?store_type='+store_type+'&apikey=' + Utility.getApikey()) + axios.delete(config.basepath + 'api/store?store_type='+store_type+'&apikey=' + Utility.getApikey()) .then(function(response) { Utility.log("resetWorkspace Success", response.data); callback_response(); @@ -130,7 +130,7 @@ class MainService { downloadMetadata(url, type, callback_response, callback_error) { Utility.log("POST /api/metadata/" + type + "/download"); - axios.post(config.basepath + '/api/metadata/' + type + '/download?apikey=' + Utility.getApikey(), {url: url}) + axios.post(config.basepath + 'api/metadata/' + type + '/download?apikey=' + Utility.getApikey(), {url: url}) .then(function(response) { Utility.log("downloadMetadata Success", response.data); callback_response(response.data); @@ -143,7 +143,7 @@ class MainService { checkMetadata(testcase, callback_response, callback_error) { Utility.log("GET /api/metadata/check/" + testcase); - axios.get(config.basepath + '/api/metadata/check/' + testcase + + axios.get(config.basepath + 'api/metadata/check/' + testcase + '?apikey=' + Utility.getApikey(), {timeout: 900000}) .then(function(response) { Utility.log("checkMetadata Success", response.data); @@ -157,7 +157,7 @@ class MainService { getLastCheck(testcase, callback_response, callback_notfound, callback_error) { Utility.log("GET /api/metadata/lastcheck/" + testcase); - axios.get(config.basepath + '/api/metadata/lastcheck/' + testcase + '?apikey=' + Utility.getApikey(), {timeout: 900000}) + axios.get(config.basepath + 'api/metadata/lastcheck/' + testcase + '?apikey=' + Utility.getApikey(), {timeout: 900000}) .then(function(response) { Utility.log("getLastCheck Success", response.data); callback_response(response.data); @@ -176,7 +176,7 @@ class MainService { patchMetadataTest(testcase, test, data, callback_response, callback_notfound, callback_error) { Utility.log("PATCH /api/metadata/" + testcase + "/" + test); axios.patch( - config.basepath + '/api/metadata/' + testcase + '/' + test + '?apikey=' + Utility.getApikey(), + config.basepath + 'api/metadata/' + testcase + '/' + test + '?apikey=' + Utility.getApikey(), {data: data}, {timeout: 900000} ) @@ -198,7 +198,7 @@ class MainService { patchOIDCTest(testcase, hook, test, data, callback_response, callback_notfound, callback_error) { Utility.log("PATCH /api/oidc/report/" + testcase + "/" + hook + "/" + test); axios.patch( - config.basepath + '/api/oidc/report/' + testcase + '/' + hook + "/" + test + '?apikey=' + Utility.getApikey(), + config.basepath + 'api/oidc/report/' + testcase + '/' + hook + "/" + test + '?apikey=' + Utility.getApikey(), {data: data}, {timeout: 900000} ) @@ -219,7 +219,7 @@ class MainService { getTestSuite(testsuite, callback_response, callback_error) { Utility.log("GET /api/test/suite/" + testsuite); - axios.get(config.basepath + '/api/test/suite/' + testsuite + '?apikey=' + Utility.getApikey(), {timeout: 900000}) + axios.get(config.basepath + 'api/test/suite/' + testsuite + '?apikey=' + Utility.getApikey(), {timeout: 900000}) .then(function(response) { Utility.log("getTestSuite Success", response.data); callback_response(response.data); @@ -232,7 +232,7 @@ class MainService { startCheck(testcase, callback_response, callback_error) { Utility.log("GET /api/oidc/check/" + testcase); - axios.get(config.basepath + '/api/oidc/check/' + testcase + '?apikey=' + Utility.getApikey(), {timeout: 900000}) + axios.get(config.basepath + 'api/oidc/check/' + testcase + '?apikey=' + Utility.getApikey(), {timeout: 900000}) .then(function(response) { Utility.log("startCheck Success", response.data); callback_response(response.data); @@ -245,7 +245,7 @@ class MainService { getReport(callback_response, callback_notfound, callback_error) { Utility.log("GET /api/oidc/report"); - axios.get(config.basepath + '/api/oidc/report' + '?apikey=' + Utility.getApikey(), {timeout: 900000}) + axios.get(config.basepath + 'api/oidc/report' + '?apikey=' + Utility.getApikey(), {timeout: 900000}) .then(function(response) { Utility.log("getReport Success", response.data); callback_response(response.data); @@ -263,7 +263,7 @@ class MainService { getServerInfo(callback_response, callback_error) { Utility.log("GET /api/server-info"); - axios.get(config.basepath + '/api/server-info', {timeout: 900000}) + axios.get(config.basepath + 'api/server-info', {timeout: 900000}) .then(function(response) { Utility.log("getServerInfo Success", response.data); callback_response(response.data); diff --git a/src/client/src/views/Login/Login.js b/src/client/src/views/Login/Login.js index 28cbba1..e225bb9 100644 --- a/src/client/src/views/Login/Login.js +++ b/src/client/src/views/Login/Login.js @@ -25,11 +25,11 @@ class Login extends Component { Utility.setApikey(data.apikey); Utility.log("Login result", Utility.isAuthenticated()); if(Utility.isAuthenticated()) { - window.location=config.basepath + "/worksave"; + window.location=config.basepath + "worksave"; } }, (tologin)=> { - if(tologin.remote) window.location=config.basepath + "/login"; + if(tologin.remote) window.location=config.basepath + "login"; else { this.setState({local_auth: true}); } diff --git a/src/client/src/views/Worksave/view.js b/src/client/src/views/Worksave/view.js index b512a36..64579ee 100644 --- a/src/client/src/views/Worksave/view.js +++ b/src/client/src/views/Worksave/view.js @@ -3,11 +3,11 @@ import BlockUi from 'react-block-ui'; import './style.css'; -function view(me) { - return ( +function view(me) { + return (
- { me.state.available_stores && me.state.available_stores.length>0 && ( + {me.state.available_stores && me.state.available_stores.length > 0 && (
{ /*me.state.available_stores && me.state.available_stores.length==1 && (
È stato selezionato il...
@@ -15,22 +15,22 @@ function view(me) { { /*me.state.available_stores && me.state.available_stores.length>1 && (
Seleziona il metadata da utilizzare...
) */} - { me.isTypeAvailable('test') && ( + {me.isTypeAvailable('test') && (
-
{me.setType('test')}}> +
{ me.setType('test') }}> - + Test Metadata
)} - { me.isTypeAvailable('prod') && ( + {me.isTypeAvailable('prod') && (
-
{me.setType('prod')}}> +
{ me.setType('prod') }}> - + Production Metadata
@@ -40,28 +40,28 @@ function view(me) {
Please choice if you want to continue a previous report or start a new one...
-
{me.startContinue()}}> +
{ me.startContinue() }}>
-

Continue

+

Continue

Continue to work on the report from the previous session keeping all the stored test results

{me.startNew()}}> + onClick={(e) => { me.startNew() }}>
-

Start New

+

Start New

Start a new session to work on a blank report resetting all the previous stored results

- ); + ); } export default view; diff --git a/src/server/api/info.js b/src/server/api/info.js index 903f18a..9cf3675 100644 --- a/src/server/api/info.js +++ b/src/server/api/info.js @@ -1,11 +1,12 @@ const fs = require("fs-extra"); const Utility = require("../lib/utils"); const config_dir = require("../../config/dir.json"); +const config_op = require("../../config/op.json"); module.exports = function(app, checkAuthorisation) { // get info from session - app.get("/api/info", function(req, res) { + app.get(config_op.basepath+"api/info", function(req, res) { // check if apikey is correct if(!checkAuthorisation(req)) { diff --git a/src/server/api/metadata.js b/src/server/api/metadata.js index 3dadba0..dbcccc6 100644 --- a/src/server/api/metadata.js +++ b/src/server/api/metadata.js @@ -6,7 +6,7 @@ const jwt_decode = require('jwt-decode'); const Utility = require('../lib/utils'); const config_dir = require('../../config/dir.json'); const config_test = require("../../config/test.json"); - +const config_op = require("../../config/op.json"); module.exports = function(app, checkAuthorisation, database) { @@ -81,7 +81,7 @@ module.exports = function(app, checkAuthorisation, database) { */ // download metadata - app.post("/api/metadata/:type/download", function(req, res) { + app.post(config_op.basepath+"api/metadata/:type/download", function(req, res) { // check if apikey is correct let authorisation = checkAuthorisation(req); @@ -181,7 +181,7 @@ module.exports = function(app, checkAuthorisation, database) { }); // execute test for metadata - app.get("/api/metadata/check/:testcase", async function(req, res) { + app.get(config_op.basepath+"api/metadata/check/:testcase", async function(req, res) { // check if apikey is correct let authorisation = checkAuthorisation(req); @@ -244,7 +244,7 @@ module.exports = function(app, checkAuthorisation, database) { }); // return last validation from store - app.get("/api/metadata/lastcheck/:testcase", function(req, res) { + app.get(config_op.basepath+"api/metadata/lastcheck/:testcase", function(req, res) { // check if apikey is correct let authorisation = checkAuthorisation(req); @@ -328,7 +328,7 @@ module.exports = function(app, checkAuthorisation, database) { */ // set test for metadata - app.patch("/api/metadata/:testcase/:test", async function(req, res) { + app.patch(config_op.basepath+"api/metadata/:testcase/:test", async function(req, res) { // check if apikey is correct let authorisation = checkAuthorisation(req); diff --git a/src/server/api/store.js b/src/server/api/store.js index 1c6366b..3161b9f 100644 --- a/src/server/api/store.js +++ b/src/server/api/store.js @@ -1,12 +1,12 @@ const fs = require("fs-extra"); const Utility = require("../lib/utils"); const config_dir = require("../../config/dir.json"); - +const config_op = require("../../config/op.json"); module.exports = function(app, checkAuthorisation, database) { // list all workspace for user and, maybe, requested store type //this not saves store to session, use GET /api/store to recover a store instead - app.get("/api/stores", function(req, res) { + app.get(config_op.basepath+"api/stores", function(req, res) { // check if apikey is correct if(!checkAuthorisation(req)) { @@ -34,7 +34,7 @@ module.exports = function(app, checkAuthorisation, database) { // recover workspace from store cache // this RECOVER store from cache and SAVE it to session - app.get("/api/store", function(req, res) { + app.get(config_op.basepath+"api/store", function(req, res) { // check if apikey is correct if(!checkAuthorisation(req)) { @@ -71,7 +71,7 @@ module.exports = function(app, checkAuthorisation, database) { }); // save workspace to store cache - app.post("/api/store", function(req, res) { + app.post(config_op.basepath+"api/store", function(req, res) { // check if apikey is correct if(!checkAuthorisation(req)) { @@ -95,7 +95,7 @@ module.exports = function(app, checkAuthorisation, database) { }); // delete workspace from store cache - app.delete("/api/store", function(req, res) { + app.delete(config_op.basepath+"api/store", function(req, res) { // check if apikey is correct if(!checkAuthorisation(req)) { diff --git a/src/server/app/auth.js b/src/server/app/auth.js index 764da42..5623287 100644 --- a/src/server/app/auth.js +++ b/src/server/app/auth.js @@ -1,81 +1,81 @@ const fs = require("fs-extra"); const path = require('path'); const sha256 = require("sha256"); -const moment = require("moment"); +const moment = require("moment"); const Utility = require("../lib/utils"); const config_op = require("../../config/op.json"); -module.exports = function(app, checkAuthorisation, authenticator) { +module.exports = function (app, checkAuthorisation, authenticator) { // local authentication - app.get("/login", (req, res)=> { - - if(config_op.agidloginAuthentication) { + app.get(config_op.basepath+"login", (req, res) => { + + if (config_op.agidloginAuthentication) { res.redirect(authenticator.getAuthURL()); - + } else { - let user = req.query.user; - let password = req.query.password; - - if((user==config_op.localloginUser && password==config_op.localloginPasswordHash)) { + let user = req.query.user; + let password = req.query.password; + + if ((user == config_op.localloginUser && password == config_op.localloginPasswordHash)) { let apikey = recLocalLoginSession(req); res.status(200).send({ apikey: apikey }); - + } else { - error = {code: 401, msg: "Unauthorized"} + error = { code: 401, msg: "Unauthorized" } console.log("ERROR /auth/local : " + error.msg + " (" + user + " : " + password + ")"); res.status(error.code).send(error.msg); - return null; + return null; } } }); // assert if local authentication apikey or AgID Login authentication - app.get("/login/assert", (req, res)=> { + app.get(config_op.basepath+"login/assert", (req, res) => { // if autoLogin autologin with localloginUser - if(config_op.autoLogin) recLocalLoginSession(req); + if (config_op.autoLogin) recLocalLoginSession(req); - if(req.session!=null && req.session.apikey!=null && req.session.apikey!='') { + if (req.session != null && req.session.apikey != null && req.session.apikey != '') { res.status(200).send({ remote: config_op.agidloginAuthentication, apikey: req.session.apikey }); } else { - error = {code: 401, data: {msg: "Unauthorized", remote: config_op.agidloginAuthentication}}; + error = { code: 401, data: { msg: "Unauthorized", remote: config_op.agidloginAuthentication } }; res.status(error.code).send(error.data); return null; } }); // AgID Login authentication - app.post("/", function(req, res, next) { + app.post("/", function (req, res, next) { let state = req.body.state; - authenticator.getUserInfo(req.body, state, (userinfo)=> { - + authenticator.getUserInfo(req.body, state, (userinfo) => { + let userpolicy = userinfo.user_policy[0]; let entity = userpolicy.entity_id; let policy = userpolicy.policy; - + let now = moment(); - let validfrom = (userpolicy.valid_from)? moment(userpolicy.valid_from) : moment(); - let validto = (userpolicy.valid_to)? moment(userpolicy.valid_to) : moment(); + let validfrom = (userpolicy.valid_from) ? moment(userpolicy.valid_from) : moment(); + let validto = (userpolicy.valid_to) ? moment(userpolicy.valid_to) : moment(); let fromnow = now.diff(validfrom, 'days'); let nowto = validto.diff(now, 'days'); - + console.log("AgID Login USER", userinfo); - + req.session.user = userinfo.email; let apikey = sha256(userinfo.sub).toString(); req.session.apikey = apikey; let basepath = config_op.basepath; - if(!basepath.endsWith('/')) basepath += '/'; + if (!basepath.endsWith('/')) basepath += '/'; res.redirect(basepath + "worksave"); - - - }, (error)=> { + + + }, (error) => { Utility.log("Error", error); res.status(500).send(error); //res.sendFile(path.resolve(__dirname, "../..", "client/view", "error.html")); @@ -84,23 +84,23 @@ module.exports = function(app, checkAuthorisation, authenticator) { }); // session logout and AgID Login global logout - app.get("/logout", (req, res)=> { + app.get(config_op.basepath+"logout", (req, res) => { req.session.destroy(); - if(config_op.agidloginAuthentication) { + if (config_op.agidloginAuthentication) { res.redirect(authenticator.getLogoutURL()); } else { let basepath = config_op.basepath; - if(!basepath.endsWith('/')) basepath += '/'; + if (!basepath.endsWith('/')) basepath += '/'; res.redirect(basepath); } }); // session logout and AgID Login global logout - app.get("/switch/:user", (req, res)=> { + app.get(config_op.basepath+"switch/:user", (req, res) => { // check if apikey is correct let authorisation = checkAuthorisation(req); - if(!authorisation) { - error = {code: 401, msg: "Unauthorized"}; + if (!authorisation) { + error = { code: 401, msg: "Unauthorized" }; res.status(error.code).send(error.msg); return null; } @@ -108,17 +108,16 @@ module.exports = function(app, checkAuthorisation, authenticator) { let user = req.params.user; req.session.user = user; let basepath = config_op.basepath; - if(!basepath.endsWith('/')) basepath += '/'; + if (!basepath.endsWith('/')) basepath += '/'; + res.redirect(basepath + "worksave"); - res.redirect(basepath + "/worksave"); - }); - + function recLocalLoginSession(req) { let user = config_op.localloginUser; let passwordHash = config_op.localloginPasswordHash; - let apikey = sha256(user + passwordHash).toString(); + let apikey = sha256(user + passwordHash).toString(); console.log("SUCCESS /auth/local : APIKEY " + apikey); req.session.user = user; req.session.apikey = apikey; diff --git a/src/server/spid-oidc-check-rp.js b/src/server/spid-oidc-check-rp.js index 51aef00..7847eb1 100644 --- a/src/server/spid-oidc-check-rp.js +++ b/src/server/spid-oidc-check-rp.js @@ -29,36 +29,53 @@ let httpsCredentials; if (useHttps) { https = require('https'); - httpsPrivateKey = fs.readFileSync(config_server.httpsPrivateKey, 'utf8'); + httpsPrivateKey = fs.readFileSync(config_server.httpsPrivateKey, 'utf8'); httpsCertificate = fs.readFileSync(config_server.httpsCertificate, 'utf8'); - httpsCredentials = {key: httpsPrivateKey, cert: httpsCertificate}; + httpsCredentials = { key: httpsPrivateKey, cert: httpsCertificate }; } var app = express(); app.use(helmet()); -app.use((req, res, next)=> { +app.use((req, res, next) => { console.log(".\n.\n."); Utility.log(moment().format("YYYY-MM-DD HH:mm:ss") + " - " + req.method + " [" + req.ips.join(' - ') + "] " + req.path); next(); }); -app.get("/", function (req, res, next) { - if(useProxy || !config_server.basepath) { +app.get("/", function (req, res, next) { + if (useProxy || !config_server.basepath) { console.log('root base path'); return next(); } - let url = config_server.host; - url += (!useProxy && httpPort)? ':' + httpPort : ''; - url += '/'; + url += (!useProxy && config_server.port)? ':' + config_server.port : ''; + if (config_server.basepath) { + if (config_server.basepath == '/') { + console.log('root base path'); + return next(); + } + else { + let basepath = config_server.basepath; + if (!basepath.endsWith('/')) basepath += '/'; + url += basepath; + } + } else { + url += '/'; + } res.redirect(url); }); -app.use(bodyParser.json({limit: '3mb', extended: true})); -app.use(bodyParser.urlencoded({limit: '3mb', extended: true})); -app.use(express.static(path.resolve(__dirname, "..", "client/build"))); +app.use(bodyParser.json({ limit: '3mb', extended: true })); +app.use(bodyParser.urlencoded({ limit: '3mb', extended: true })); +let basepath = config_server.basepath; +if (basepath) { + if (!basepath.endsWith('/')) basepath += '/'; +} else { + basepath='/'; +} +app.use(basepath,express.static(path.resolve(__dirname, "..", "client/build"))); app.set('trust proxy', 1); app.use(session({ @@ -66,9 +83,9 @@ app.use(session({ secret: "OIDC CHECK RP", resave: false, saveUninitialized: false, - cookie: { - secure: config_server.useHttps? true : false, - maxAge: 60*60000 + cookie: { + secure: config_server.useHttps ? true : false, + maxAge: 60 * 60000 } //30*60000: 30min })); @@ -77,21 +94,21 @@ app.use(session({ var database = new Database().connect().setup(); // create authenticator -var authenticator = config_op.agidloginAuthentication? new Authenticator("validator") : null; +var authenticator = config_op.agidloginAuthentication ? new Authenticator("validator") : null; // Private Funcs -var checkAuth = function(req) { +var checkAuth = function (req) { // 'API' if checkBasicAuth = true // true if checkSessionAuth = true // else false return checkBasicAuth(req) || checkSessionAuth(req); } -var checkSessionAuth = function(req) { +var checkSessionAuth = function (req) { let authorised = false; let apikey = req.query.apikey; - if(apikey!=null && apikey == req.session.apikey) { + if (apikey != null && apikey == req.session.apikey) { authorised = true; } else { Utility.log("Authorisation", "ERROR check authorisation : " + apikey); @@ -100,50 +117,50 @@ var checkSessionAuth = function(req) { return authorised; } -var checkBasicAuth = function(req) { +var checkBasicAuth = function (req) { let authorised = false; - if(req.headers.authorization - && req.headers.authorization.substr(0,5)=="Basic") { + if (req.headers.authorization + && req.headers.authorization.substr(0, 5) == "Basic") { let authorization = req.headers.authorization.substr(6); let authorization_buffer = new Buffer(authorization, 'base64'); let authorization_plain = authorization_buffer.toString('ascii'); let user = authorization_plain.split(":")[0]; let pass = authorization_plain.split(":")[1]; - if(config_api[user]==pass) authorised = 'API'; + if (config_api[user] == pass) authorised = 'API'; Utility.log("Authorisation API", authorization_plain); } return authorised; } /* Authentication */ -require('./app/auth') (app, checkAuth, authenticator); +require('./app/auth')(app, checkAuth, authenticator); /* OIDC Provider Validator */ -if(config_op.enabled) require('./app/op') (app, checkAuth, database); +if (config_op.enabled) require('./app/op')(app, checkAuth, database); /* OIDC Provider Demo */ //if(config_op_demo.enabled) require('./app/op_demo') (app, checkAuth, database); /* API Validator */ -require('./api/test') (app, checkAuth); -require('./api/metadata') (app, checkAuth, database); -require('./api/oidc') (app, checkAuth, database); -require('./api/store') (app, checkAuth, database); -require('./api/info') (app, checkAuth); -require('./api/server-info') (app); +require('./api/test')(app, checkAuth); +require('./api/metadata')(app, checkAuth, database); +require('./api/oidc')(app, checkAuth, database); +require('./api/store')(app, checkAuth, database); +require('./api/info')(app, checkAuth); +require('./api/server-info')(app); // routes all to React Router -app.get('*', (req, res)=> { +app.get('*', (req, res) => { console.log("Route to front-end"); - res.sendFile(path.resolve(__dirname + '/../client/build/index.html')); + res.sendFile(path.resolve(__dirname + '/../client/build/index.html')); }); // start -if(useHttps) app = https.createServer(httpsCredentials, app); +if (useHttps) app = https.createServer(httpsCredentials, app); app.listen(httpPort, () => { console.log("\n" + p.name + "\nversion: " + p.version);