Compare commits

...

3 Commits

Author SHA1 Message Date
revvie
a8093f4d5d user form 2018-03-13 17:41:06 +02:00
revvie
b0c4f991ba second form 2018-03-13 17:29:56 +02:00
revvie
b218769fac Logging search box output to server console 2018-03-08 14:48:47 +02:00
6 changed files with 39 additions and 154 deletions

View File

@ -1,143 +0,0 @@
@import url(https://fonts.googleapis.com/css?family=Cabin:400);
.search-form {
background: #151515;
height: 100%;
position: absolute;
text-align: center;
width: 100%;
}
.search-form:before,
.search-form:after {
content: '';
display: block;
height: 1px;
left: 50%;
margin: 0 0 0 -400px;
position: absolute;
width: 800px;
}
.search-form:before {
background: #444;
background: linear-gradient(left, #151515, #444, #151515);
top: 192px;
}
.search-form:after {
background: #000;
background: linear-gradient(left, #151515, #000, #151515);
top: 191px;
}
.search-form form {
background: #111;
background: linear-gradient(#1b1b1b, #111);
border: 1px solid #000;
border-radius: 5px;
box-shadow: inset 0 0 0 1px #272727;
display: inline-block;
font-size: 0px;
margin: 150px auto 0;
padding: 20px;
position: relative;
z-index: 1;
}
.search-form input {
background: #222;
background: linear-gradient(#333, #222);
border: 1px solid #444;
border-radius: 5px 0 0 5px;
box-shadow: 0 2px 0 #000;
color: #888;
display: block;
float: left;
font-family: 'Cabin', helvetica, arial, sans-serif;
font-size: 13px;
font-weight: 400;
height: 40px;
margin: 0;
padding: 0 10px;
text-shadow: 0 -1px 0 #000;
width: 200px;
}
.ie .search-form input {
line-height: 40px;
}
.search-form input::-webkit-input-placeholder {
color: #888;
}
.search-form input:-moz-placeholder {
color: #888;
}
.search-form input:focus {
animation: glow 800ms ease-out infinite alternate;
background: #222922;
background: linear-gradient(#333933, #222922);
border-color: #393;
box-shadow: 0 0 5px rgba(0, 255, 0, .2), inset 0 0 5px rgba(0, 255, 0, .1), 0 2px 0 #000;
color: #efe;
outline: none;
}
.search-form input:focus::-webkit-input-placeholder {
color: #efe;
}
.search-form input:focus:-moz-placeholder {
color: #efe;
}
.search-form button {
background: #222;
background: linear-gradient(#333, #222);
box-sizing: border-box;
border: 1px solid #444;
border-left-color: #000;
border-radius: 0 5px 5px 0;
box-shadow: 0 2px 0 #000;
color: #fff;
display: block;
float: left;
font-family: 'Cabin', helvetica, arial, sans-serif;
font-size: 13px;
font-weight: 400;
height: 40px;
line-height: 40px;
margin: 0;
padding: 0;
position: relative;
text-shadow: 0 -1px 0 #000;
width: 80px;
}
.search-form button:hover,
.search-form button:focus {
background: #292929;
background: linear-gradient(#393939, #292929);
color: #5f5;
outline: none;
}
.search-form button:active {
background: #292929;
background: linear-gradient(#393939, #292929);
box-shadow: 0 1px 0 #000, inset 1px 0 1px #222;
top: 1px;
}
@keyframes glow {
0% {
border-color: #393;
box-shadow: 0 0 5px rgba(0, 255, 0, .2), inset 0 0 5px rgba(0, 255, 0, .1), 0 2px 0 #000;
}
100% {
border-color: #6f6;
box-shadow: 0 0 20px rgba(0, 255, 0, .6), inset 0 0 10px rgba(0, 255, 0, .4), 0 2px 0 #000;
}
}

View File

@ -9,6 +9,10 @@ const path = require('path')
const express = require('express')
const bodyParser = require('body-parser')
const chalk = require('chalk')
const pg = require('pg')
// initialize an pg instance
const pgConnection = "postgres://postgres:postgres@localhost:5432/books"
// initialize an express instance
const server = express()
@ -29,6 +33,7 @@ if (process.env.NODE_ENV !== 'production') {
server.use(bodyParser.json())
server.use(bodyParser.urlencoded({ extended: true }))
// server routes
server.get('/', (req, res, next) => {
res.render('index')
})
@ -45,6 +50,15 @@ server.get('/result', (req, res, next) => {
})
})
server.post('/search', (req, res, next) => {
console.log(req.body)
res.status(200).redirect('/result')
})
server.post('/login', (req, res, next) => {
console.log(req.body)
})
// server.use('/', (req, res, next) => {
// console.log('hello')
// res.send('<h1>Hello</h1>')

View File

@ -6,8 +6,6 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Goodreads API</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<link rel="stylesheet" href="/public/main.css" />
</head>
@ -16,8 +14,14 @@
<h1>Deem</h1>
<nav>
<ul>
<li><a href="/">Start</a></li>
<li><a href="/search">Search</a></li>
<li><a href="/result">Result</a></li>
<li>
<a href="/">Start</a>
</li>
<li>
<a href="/search">Search</a>
</li>
<li>
<a href="/result">Result</a>
</li>
</ul>
</nav>
</nav>

View File

@ -4,4 +4,5 @@
<p>To the most legit website in the world. Besides rating books you can also buy pretty good drugs.</p>
<% include login %>
<% include footer %>

View File

@ -0,0 +1,11 @@
<!-- <% include header %> -->
<form class="pure-form" action="/login" method="POST">
<input type="text" name="name" placeholder="Enter name" autofocus required />
<input type="text" name="familyname" placeholder="Enter family name" autofocus required />
<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 %> -->

View File

@ -1,10 +1,8 @@
<% include header %>
<section class="search-form">
<form class="pure-form " action="" method="">
<input type="text" placeholder="Enter ISBN" autofocus required />
<button>Search</button>
<form class="pure-form " action="/search" method="POST">
<input type="text" name="ISBN" placeholder="Enter ISBN" autofocus required />
<input type="submit" value="Submit">
</form>
</section>
<% include footer %>