second form
This commit is contained in:
parent
b218769fac
commit
b0c4f991ba
@ -9,6 +9,10 @@ const path = require('path')
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const bodyParser = require('body-parser')
|
const bodyParser = require('body-parser')
|
||||||
const chalk = require('chalk')
|
const chalk = require('chalk')
|
||||||
|
const pg = require('pg')
|
||||||
|
|
||||||
|
// initialize an pg instance
|
||||||
|
const pgConnection = "postgres://postgres:postgres@localhost:5432/books"
|
||||||
|
|
||||||
// initialize an express instance
|
// initialize an express instance
|
||||||
const server = express()
|
const server = express()
|
||||||
@ -29,6 +33,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|||||||
server.use(bodyParser.json())
|
server.use(bodyParser.json())
|
||||||
server.use(bodyParser.urlencoded({ extended: true }))
|
server.use(bodyParser.urlencoded({ extended: true }))
|
||||||
|
|
||||||
|
// server routes
|
||||||
server.get('/', (req, res, next) => {
|
server.get('/', (req, res, next) => {
|
||||||
res.render('index')
|
res.render('index')
|
||||||
})
|
})
|
||||||
@ -50,6 +55,10 @@ server.post('/search', (req, res, next) => {
|
|||||||
res.status(200).redirect('/result')
|
res.status(200).redirect('/result')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
server.post('/login', (req, res, next) => {
|
||||||
|
console.log(req.body)
|
||||||
|
})
|
||||||
|
|
||||||
// server.use('/', (req, res, next) => {
|
// server.use('/', (req, res, next) => {
|
||||||
// console.log('hello')
|
// console.log('hello')
|
||||||
// res.send('<h1>Hello</h1>')
|
// res.send('<h1>Hello</h1>')
|
||||||
|
|||||||
@ -14,8 +14,14 @@
|
|||||||
<h1>Deem</h1>
|
<h1>Deem</h1>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/">Start</a></li>
|
<li>
|
||||||
<li><a href="/search">Search</a></li>
|
<a href="/">Start</a>
|
||||||
<li><a href="/result">Result</a></li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/search">Search</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/result">Result</a>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
@ -4,4 +4,5 @@
|
|||||||
|
|
||||||
<p>To the most legit website in the world. Besides rating books you can also buy pretty good drugs.</p>
|
<p>To the most legit website in the world. Besides rating books you can also buy pretty good drugs.</p>
|
||||||
|
|
||||||
|
<% include login %>
|
||||||
<% include footer %>
|
<% include footer %>
|
||||||
|
|||||||
14
server/templates/login.ejs
Normal file
14
server/templates/login.ejs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<!-- <% include header %> -->
|
||||||
|
|
||||||
|
<form class="pure-form" action="/login" method="POST">
|
||||||
|
<p>Login:</p>
|
||||||
|
<input type="text" name="Username" placeholder="Enter username" autofocus required />
|
||||||
|
<input type="password" name="Password" placeholder="Enter password" autofocus required />
|
||||||
|
<input type="submit" value="Login">
|
||||||
|
<p>Create account</p>
|
||||||
|
<input type="text" name="Desired username" placeholder="Enter username" autofocus required />
|
||||||
|
<input type="text" name="Email" placeholder="Enter email" autofocus required />
|
||||||
|
<input type="submit" value="Create">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<!-- <% include footer %> -->
|
||||||
Loading…
Reference in New Issue
Block a user