fixed error
This commit is contained in:
9
index.js
9
index.js
@@ -9,7 +9,8 @@ require('dotenv').config()
|
||||
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use(express.static(path.join(__dirname, 'static')));
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use('/static', express.static('public'))
|
||||
|
||||
app.use(session({
|
||||
secret: process.env.SESSION_SECRET,
|
||||
@@ -28,15 +29,15 @@ const client = new Client({
|
||||
//create connection to database
|
||||
|
||||
client.connect()
|
||||
.then(() => console.log('Connected to database'))
|
||||
.then(() => console.log('Successfully connected to database'))
|
||||
.catch((err) => console.log('Error on connecting to database: ', err));
|
||||
|
||||
|
||||
|
||||
app.get('/login', (req, res) => {
|
||||
response.sendFile(path.join(__dirname + '/routes/login.html'));
|
||||
res.sendFile(path.join(__dirname, '/public/routes/login.html'));
|
||||
})
|
||||
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening on port ${port}`)
|
||||
})
|
||||
|
||||
@@ -5,21 +5,22 @@
|
||||
<meta name="viewport"
|
||||
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>Document</title>
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="login">
|
||||
<h1>Login</h1>
|
||||
<form action="/auth" method="post">
|
||||
|
||||
<label for="username">
|
||||
<i class="fas fa-user"></i>
|
||||
</label>
|
||||
<input type="text" name="username" placeholder="Username" id="username" required>
|
||||
|
||||
<label for="password">
|
||||
<i class="fas fa-lock"></i>
|
||||
</label>
|
||||
<input type="password" name="password" placeholder="Password" id="password" required>
|
||||
|
||||
<input type="submit" value="Login">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user