From a0984782a8ce9f8c1b5b3877ba02c5c53701806a Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Sun, 27 Aug 2023 13:54:07 +0200 Subject: [PATCH] add testing of new method of start page --- notes.md | 2 ++ src/server/app.js | 15 +++++++++++++++ src/server/backend/db/data/db.json | 2 +- src/server/ui/home/active/en/index.html | 11 +++++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/server/ui/home/active/en/index.html diff --git a/notes.md b/notes.md index 1d01bd5..300b122 100644 --- a/notes.md +++ b/notes.md @@ -2,6 +2,8 @@ - Load all orders of customer from db when selecting tickets and save to memory to check if ticket count has been exceeded or not. +- fix ticket counting + - Update files to import when deploying for included json files instead of secret.json files diff --git a/src/server/app.js b/src/server/app.js index 86a9b07..1df06df 100644 --- a/src/server/app.js +++ b/src/server/app.js @@ -47,6 +47,19 @@ To do this run the following command when starting libreevent: console.log( '[ Server ] loading settings' ); const settings = JSON.parse( fs.readFileSync( path.join( __dirname + '/config/settings.config.json' ) ) ); + +// Route for static html file for start page (page is compiled using +// Vue SSR and gets its support files (e.g. CSS and JS files) from +// the /home/supportFiles/:file route plus its assets from the /otherAssets/:file +// route). + +app.get( '/', ( req, res ) => { + res.sendFile( path.join( __dirname + '/ui/home/active/en/index.html' ) ); +} ); + + +// Set up static routes for static file serving (performance wise not +// that good, but way easier to set up) console.log( '[ Server ] Setting up static routes' ); if ( settings.init ) { app.use( express.static( 'webapp/main/dist' ) ); @@ -84,6 +97,8 @@ if ( settings.init ) { file = path.join( __dirname + '/webapp/setup/dist/index.html' ); } +// handling of any unknown route. Returns the SPA index.html file which +// initiates loading of the SPA app.use( ( request, response ) => { response.sendFile( file ); } ); diff --git a/src/server/backend/db/data/db.json b/src/server/backend/db/data/db.json index 9e26dfe..0b568e1 100644 --- a/src/server/backend/db/data/db.json +++ b/src/server/backend/db/data/db.json @@ -1 +1 @@ -{} \ No newline at end of file +{"db":{"libreevent_temp":{},"libreevent_admin":{},"libreevent_orders":{},"libreevent_users":{}},"index":{"libreevent_temp":0,"libreevent_admin":0,"libreevent_orders":0,"libreevent_users":0}} \ No newline at end of file diff --git a/src/server/ui/home/active/en/index.html b/src/server/ui/home/active/en/index.html new file mode 100644 index 0000000..01bb467 --- /dev/null +++ b/src/server/ui/home/active/en/index.html @@ -0,0 +1,11 @@ + + + + + + Document + + +

Test

+ + \ No newline at end of file