diff --git a/code/00-starting-project/app.js b/code/00-starting-project/app.js new file mode 100644 index 0000000..ded8679 --- /dev/null +++ b/code/00-starting-project/app.js @@ -0,0 +1,5 @@ +const express = require('express'); + +const app = express(); + +app.listen(3000); \ No newline at end of file diff --git a/code/00-starting-project/package.json b/code/00-starting-project/package.json new file mode 100644 index 0000000..e4e54d3 --- /dev/null +++ b/code/00-starting-project/package.json @@ -0,0 +1,18 @@ +{ + "name": "web-dev-complete-guide", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "nodemon app.js" + }, + "keywords": [], + "author": "Maximilian Schwarzmüller", + "license": "ISC", + "dependencies": { + "express": "^4.17.1" + }, + "devDependencies": { + "nodemon": "^2.0.12" + } +} diff --git a/code/01-adding-ejs-first-views/app.js b/code/01-adding-ejs-first-views/app.js new file mode 100644 index 0000000..a4abb68 --- /dev/null +++ b/code/01-adding-ejs-first-views/app.js @@ -0,0 +1,14 @@ +const path = require('path'); + +const express = require('express'); + +const authRoutes = require('./routes/auth.routes'); + +const app = express(); + +app.set('view engine', 'ejs'); +app.set('views', path.join(__dirname, 'views')); + +app.use(authRoutes); + +app.listen(3000); \ No newline at end of file diff --git a/code/01-adding-ejs-first-views/controllers/auth.controller.js b/code/01-adding-ejs-first-views/controllers/auth.controller.js new file mode 100644 index 0000000..d2b8158 --- /dev/null +++ b/code/01-adding-ejs-first-views/controllers/auth.controller.js @@ -0,0 +1,12 @@ +function getSignup(req, res) { + // ... +} + +function getLogin(req, res) { + // ... +} + +module.exports = { + getSignup: getSignup, + getLogin: getLogin +}; diff --git a/code/01-adding-ejs-first-views/package.json b/code/01-adding-ejs-first-views/package.json new file mode 100644 index 0000000..f4f3955 --- /dev/null +++ b/code/01-adding-ejs-first-views/package.json @@ -0,0 +1,19 @@ +{ + "name": "web-dev-complete-guide", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "nodemon app.js" + }, + "keywords": [], + "author": "Maximilian Schwarzmüller", + "license": "ISC", + "dependencies": { + "ejs": "^3.1.6", + "express": "^4.17.1" + }, + "devDependencies": { + "nodemon": "^2.0.12" + } +} diff --git a/code/01-adding-ejs-first-views/routes/auth.routes.js b/code/01-adding-ejs-first-views/routes/auth.routes.js new file mode 100644 index 0000000..e0c366b --- /dev/null +++ b/code/01-adding-ejs-first-views/routes/auth.routes.js @@ -0,0 +1,11 @@ +const express = require('express'); + +const authController = require('../controllers/auth.controller'); + +const router = express.Router(); + +router.get('/signup', authController.getSignup); + +router.get('/login', authController.getLogin); + +module.exports = router; \ No newline at end of file diff --git a/code/01-adding-ejs-first-views/views/customer/auth/login.ejs b/code/01-adding-ejs-first-views/views/customer/auth/login.ejs new file mode 100644 index 0000000..e69de29 diff --git a/code/01-adding-ejs-first-views/views/customer/auth/signup.ejs b/code/01-adding-ejs-first-views/views/customer/auth/signup.ejs new file mode 100644 index 0000000..d9b2f6f --- /dev/null +++ b/code/01-adding-ejs-first-views/views/customer/auth/signup.ejs @@ -0,0 +1,11 @@ +<%- include('../includes/head', { pageTitle: 'Signup' }) %> + +
+ <%- include('../includes/header') %> +