From b0c4f991ba1bf826f5172698f4f66a5fd2c566cd Mon Sep 17 00:00:00 2001 From: revvie Date: Tue, 13 Mar 2018 17:29:56 +0200 Subject: [PATCH] second form --- server/server.js | 9 +++++++++ server/templates/header.ejs | 14 ++++++++++---- server/templates/index.ejs | 1 + server/templates/login.ejs | 14 ++++++++++++++ 4 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 server/templates/login.ejs diff --git a/server/server.js b/server/server.js index f4ea7f0..2fd212d 100644 --- a/server/server.js +++ b/server/server.js @@ -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') }) @@ -50,6 +55,10 @@ server.post('/search', (req, res, next) => { 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('

Hello

') diff --git a/server/templates/header.ejs b/server/templates/header.ejs index 9dce54f..6191de8 100644 --- a/server/templates/header.ejs +++ b/server/templates/header.ejs @@ -14,8 +14,14 @@

Deem

+ \ No newline at end of file diff --git a/server/templates/index.ejs b/server/templates/index.ejs index 456f962..57655c3 100644 --- a/server/templates/index.ejs +++ b/server/templates/index.ejs @@ -4,4 +4,5 @@

To the most legit website in the world. Besides rating books you can also buy pretty good drugs.

+<% include login %> <% include footer %> diff --git a/server/templates/login.ejs b/server/templates/login.ejs new file mode 100644 index 0000000..f7e07f4 --- /dev/null +++ b/server/templates/login.ejs @@ -0,0 +1,14 @@ + + +
+

Login:

+ + + +

Create account

+ + + +
+ + \ No newline at end of file