From 3e1bf443ea3464a8c70eb816fd3a5d98788ab5b7 Mon Sep 17 00:00:00 2001 From: Aljaz S Date: Tue, 23 Nov 2021 18:10:25 +0100 Subject: [PATCH] make backend serve static content remove style template and use static style.css file --- src/index.js | 2 ++ src/{template/style.ejs => public/style.css} | 36 ++++++++++++++------ src/views/form.ejs | 5 ++- src/views/index.ejs | 2 +- 4 files changed, 30 insertions(+), 15 deletions(-) rename src/{template/style.ejs => public/style.css} (77%) diff --git a/src/index.js b/src/index.js index 5c0f269..3bfa230 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,8 @@ const app = express() const __dirname = dirname(fileURLToPath(import.meta.url)) app.use(cors()) +app.use('/public', express.static('public')) + app.set('views', path.join(__dirname, 'views')) app.set('view engine', 'ejs') diff --git a/src/template/style.ejs b/src/public/style.css similarity index 77% rename from src/template/style.ejs rename to src/public/style.css index a627516..8a6c6a7 100644 --- a/src/template/style.ejs +++ b/src/public/style.css @@ -1,14 +1,28 @@ - \ No newline at end of file +} \ No newline at end of file diff --git a/src/views/form.ejs b/src/views/form.ejs index f2f2307..a0fa635 100644 --- a/src/views/form.ejs +++ b/src/views/form.ejs @@ -5,8 +5,8 @@ UPN-QR :: FORM + -<%- include('../template/style.ejs') -%>