aboutsummaryrefslogtreecommitdiff
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/web.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/routes/web.js b/routes/web.js
new file mode 100644
index 0000000..a1a7b01
--- /dev/null
+++ b/routes/web.js
@@ -0,0 +1,23 @@
+const express = require('express');
+const router = express.Router();
+
+router.get('/', (req, res) => {
+ res.render('home', {
+ title: 'Home Page',
+ home: true
+ });
+});
+
+router.get('/new-post', (req, res) => {
+ res.render('new-post', {
+ title: 'Make A New Post',
+ newPost: true
+ });
+});
+
+router.post('/new-post', (req, res) => {
+ console.log(req.body);
+ res.redirect('/');
+});
+
+module.exports = router;