make backend serve static content

remove style template and use static style.css file
This commit is contained in:
Aljaz S
2021-11-23 18:10:25 +01:00
parent fe9fb9f083
commit 3e1bf443ea
4 changed files with 30 additions and 15 deletions

View File

@@ -9,6 +9,8 @@ const app = express()
const __dirname = dirname(fileURLToPath(import.meta.url)) const __dirname = dirname(fileURLToPath(import.meta.url))
app.use(cors()) app.use(cors())
app.use('/public', express.static('public'))
app.set('views', path.join(__dirname, 'views')) app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'ejs') app.set('view engine', 'ejs')

View File

@@ -1,14 +1,28 @@
<style>
body, body,
html { html {
margin: 0; margin: 0;
padding: 0; padding: 0;
max-width: 100vw; max-width: 100vw;
overflow-x: hidden; overflow-x: hidden;
--c-dark: #202124; --c-dark-val: 32, 33, 36;
--c-darkish: #303134; --c-darkish-val: 48, 49, 52;
--c-primary: #e8eaed; --c-primary-val: 232, 234, 237;
--c-accent: #C58AF9; --c-accent-val: 197, 138, 249;
--c-dark: rgb(var(--c-dark-val));
--c-darkish: rgb(var(--c-darkish-val));
--c-primary: rgb(var(--c-primary-val));
--c-accent: rgb(var(--c-accent-val));
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
::-moz-selection,
::selection {
background: rgba(var(--c-accent-val), .5);
} }
html { html {
@@ -52,19 +66,20 @@ pre {
overflow-x: scroll; overflow-x: scroll;
} }
input { input {
background-color: var(--c-darkish); background-color: var(--c-dark);
border-color: var(--c-dark); border-color: var(--c-dark);
color: var(--c-primary); color: var(--c-primary);
padding: 8px 8px 6px 10px; padding: 8px 8px 6px 10px;
border-radius: 4px; border-radius: 4px;
font-family: monospace; font-family: monospace;
outline: none;
} }
input:read-only { input:read-only {
cursor: default; cursor: default;
background-color: var(--c-dark); background-color: var(--c-darkish);
} }
input:focus, input:focus:not(:readonly),
input:focus-visible { input:focus-visible:not(:readonly) {
border-color: transparent; border-color: transparent;
outline: solid 1px var(--c-accent); outline: solid 1px var(--c-accent);
} }
@@ -104,5 +119,4 @@ button:active {
border: none; border: none;
box-shadow: none; box-shadow: none;
margin: 4px 0 0 4px; margin: 4px 0 0 4px;
} }
</style>

View File

@@ -5,8 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UPN-QR :: FORM</title> <title>UPN-QR :: FORM</title>
<link rel="stylesheet" href="/public/style.css">
</head> </head>
<%- include('../template/style.ejs') -%>
<style> <style>
div { div {
@@ -53,8 +53,7 @@ div {
<h1>Form: <%= q["title"] %></h1> <h1>Form: <%= q["title"] %></h1>
<span>Create your form here: <a href="/#maker">/#maker</a></span> <span>Create your form here: <a href="/#maker">/#maker</a></span>
</div> </div>
<div class="code" id="qrcode"> <div class="code" id="qrcode"></div>
</div>
<div class="form"> <div class="form">
<% <%
const items = [ const items = [

View File

@@ -5,8 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>UPN-QR | Open generator for UPN QR codes</title> <title>UPN-QR | Open generator for UPN QR codes</title>
<link rel="stylesheet" href="/public/style.css">
</head> </head>
<%- include('../template/style.ejs') -%>
<style> <style>
section div { section div {
padding-left: 25px; padding-left: 25px;