diff --git a/app.js b/app.js index ecf6922..f8de6b4 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,8 @@ +const path = require('path') const express = require('express') const dotenv = require('dotenv') +const morgan = require('morgan') +const exphbs = require('express-handlebars') const connectDB = require('./config/db') // Load config @@ -9,6 +12,27 @@ connectDB() const app = express() +// Logging +if (process.env.NODE_ENV === 'development') { + app.use(morgan('dev')) +} + +// Handlebars +app.engine( + '.hbs', + exphbs({ + defaultLayout: 'main', + extname: '.hbs', + }) +) +app.set('view engine', '.hbs') + +// Static folder +app.use(express.static(path.join(__dirname, 'public'))) + +// Routes +app.use('/', require('./routes/index')) + const PORT = process.env.PORT || 3000 app.listen( diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..83cad22 --- /dev/null +++ b/public/css/style.css @@ -0,0 +1,22 @@ +p { + margin: 10px 0 !important; +} + +.login-container { + width: 400px; + margin-top: 50px; + text-align: center; +} + +.fa-small { + font-size: 16px !important; +} + +.btn-float { + float: left; + margin-right: 10px; +} + +.img-small { + width: 180px; +} diff --git a/routes/index.js b/routes/index.js new file mode 100644 index 0000000..a2d9b4a --- /dev/null +++ b/routes/index.js @@ -0,0 +1,18 @@ +const express = require('express') +const router = express.Router() + +// @desc Login/Landing page +// @route GET / +router.get('/', (req, res) => { + res.render('login', { + layout: 'login', + }) +}) + +// @desc Dashboard +// @route GET /dashboard +router.get('/dashboard', (req, res) => { + res.render('dashboard') +}) + +module.exports = router diff --git a/views/dashboard.hbs b/views/dashboard.hbs new file mode 100644 index 0000000..088dbda --- /dev/null +++ b/views/dashboard.hbs @@ -0,0 +1 @@ +

Dashboard

\ No newline at end of file diff --git a/views/layouts/login.hbs b/views/layouts/login.hbs new file mode 100644 index 0000000..2c004aa --- /dev/null +++ b/views/layouts/login.hbs @@ -0,0 +1,26 @@ + + + + + + + + + + StoryBooks Login + + + +
+
+
+ {{{body}}} +
+
+
+ + + + + \ No newline at end of file diff --git a/views/layouts/main.hbs b/views/layouts/main.hbs new file mode 100644 index 0000000..b5b5295 --- /dev/null +++ b/views/layouts/main.hbs @@ -0,0 +1,35 @@ + + + + + + + + + + StoryBooks + + + + {{> _header}} + {{> _add_btn}} +
+ {{{body}}} +
+ + + + + + + + \ No newline at end of file diff --git a/views/login.hbs b/views/login.hbs new file mode 100644 index 0000000..4cf44ad --- /dev/null +++ b/views/login.hbs @@ -0,0 +1,10 @@ +

StoryBooks

+
+

Create public and private stories from your life

+
+
+
+ + Log In With Google + +
\ No newline at end of file diff --git a/views/partials/_add_btn.hbs b/views/partials/_add_btn.hbs new file mode 100644 index 0000000..d30d96f --- /dev/null +++ b/views/partials/_add_btn.hbs @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/views/partials/_header.hbs b/views/partials/_header.hbs new file mode 100644 index 0000000..0943d2a --- /dev/null +++ b/views/partials/_header.hbs @@ -0,0 +1,12 @@ + \ No newline at end of file