express-sweet-generator 2.0.4 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-sweet-generator",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "EXPRESS SWEET application generator.",
5
5
  "main": "bin/express-sweet-cli.js",
6
6
  "files": [
Binary file
Binary file
@@ -70,12 +70,17 @@ module.exports = {
70
70
  * @example
71
71
  * hook_handle_error: (err, req, res, next) => {
72
72
  * if (err.status === 404)
73
- * // If the URL cannot be found, a 404 error screen (views/error-404.hbs) is displayed.
74
- * res.render('error-404');
73
+ * // If the URL cannot be found, a 404 error screen (views/errors/404.hbs) is displayed.
74
+ * res.render('errors/404');
75
75
  * else
76
- * // For other errors, unknown error screen (views/error-unknown.hbs) is displayed.
77
- * res.render('error-unknown');
76
+ * // For other errors, unknown error screen (views/error/500.hbs) is displayed.
77
+ * res.render('error/500');
78
78
  * },
79
79
  */
80
- hook_handle_error: undefined,
80
+ hook_handle_error: (err, req, res, next) => {
81
+ if (err.status === 404)
82
+ res.status(404).render('errors/404', {isErrorPage: true});
83
+ else
84
+ res.status(500).render('errors/500', {isErrorPage: true});
85
+ },
81
86
  }
@@ -6,6 +6,7 @@ const UserNotFound = require('../../exceptions/UserNotFound');
6
6
  const CustomValidation = require('../../shared/CustomValidation');
7
7
 
8
8
  const router = express.Router();
9
+
9
10
  router.post('/login', [
10
11
  body('email').trim().not().isEmpty().isEmail(),
11
12
  body('password').trim().not().isEmpty()
@@ -111,4 +112,5 @@ router.put('/profile', [
111
112
  next(err);
112
113
  }
113
114
  });
115
+
114
116
  module.exports = router;
@@ -1,7 +1,9 @@
1
1
  const express = require('express');
2
2
 
3
3
  const router = express.Router();
4
+
4
5
  router.get('/', (req, res) => {
5
6
  res.render('login');
6
7
  });
8
+
7
9
  module.exports = router;
@@ -2,6 +2,7 @@ const express = require('express');
2
2
  const UserModel = require('../models/UserModel');
3
3
 
4
4
  const router = express.Router();
5
+
5
6
  router.get('/', (req, res) => {
6
7
  res.render('users');
7
8
  });
@@ -15,4 +16,5 @@ router.get('/edit-personal', async (req, res) => {
15
16
  const user = await UserModel.getUser(req.user.id);
16
17
  res.render('edit-personal', {user: user.toJSON()});
17
18
  });
19
+
18
20
  module.exports = router;
@@ -0,0 +1,44 @@
1
+ {{!< default}}
2
+ {{#contentFor 'title'}}404 Error: Page Not Found{{/contentFor}}
3
+ {{#contentFor 'style'}}
4
+ <style>
5
+ body {
6
+ background-image: url('/build/theme/media/auth/bg6.jpg');
7
+ }
8
+
9
+ [data-bs-theme="dark"] body {
10
+ background-image: url('/build/theme/media/auth/bg6-dark.jpg');
11
+ }
12
+ </style>
13
+ {{/contentFor}}
14
+ <!--begin::Authentication - Signup Welcome Message -->
15
+ <div class="d-flex flex-column flex-center flex-column-fluid">
16
+ <!--begin::Content-->
17
+ <div class="d-flex flex-column flex-center text-center p-10">
18
+ <!--begin::Wrapper-->
19
+ <div class="card card-flush w-lg-650px py-5">
20
+ <div class="card-body py-15 py-lg-20">
21
+ <!--begin::Title-->
22
+ <h1 class="fw-bolder fs-2hx mb-4">404 Error: Page Not Found</h1>
23
+ <!--end::Title-->
24
+ <!--begin::Text-->
25
+ <div class="fw-semibold fs-6 mb-7">The page you requested could not be found. Please check the URL and try again. If the problem persists, please contact us.</div>
26
+ <!--end::Text-->
27
+ <!--begin::Illustration-->
28
+ <div class="mb-3">
29
+ <img src="/build/theme/media/auth/404-error.png" class="mw-100 mh-300px theme-light-show" alt="" />
30
+ <img src="/build/theme/media/auth/404-error-dark.png" class="mw-100 mh-300px theme-dark-show" alt="" />
31
+ </div>
32
+ <!--end::Illustration-->
33
+ <!--begin::Link-->
34
+ <div class="mb-0">
35
+ <a href="/" class="btn btn-sm btn-primary">Back to Home</a>
36
+ </div>
37
+ <!--end::Link-->
38
+ </div>
39
+ </div>
40
+ <!--end::Wrapper-->
41
+ </div>
42
+ <!--end::Content-->
43
+ </div>
44
+ <!--end::Authentication - Signup Welcome Message-->
@@ -0,0 +1,44 @@
1
+ {{!< default}}
2
+ {{#contentFor 'title'}}500 Error: Server Error{{/contentFor}}
3
+ {{#contentFor 'style'}}
4
+ <style>
5
+ body {
6
+ background-image: url('/build/theme/media/auth/bg6.jpg');
7
+ }
8
+
9
+ [data-bs-theme="dark"] body {
10
+ background-image: url('/build/theme/media/auth/bg6-dark.jpg');
11
+ }
12
+ </style>
13
+ {{/contentFor}}
14
+ <!--begin::Authentication - Signup Welcome Message -->
15
+ <div class="d-flex flex-column flex-center flex-column-fluid">
16
+ <!--begin::Content-->
17
+ <div class="d-flex flex-column flex-center text-center p-10">
18
+ <!--begin::Wrapper-->
19
+ <div class="card card-flush w-lg-650px py-5">
20
+ <div class="card-body py-15 py-lg-20">
21
+ <!--begin::Title-->
22
+ <h1 class="fw-bolder fs-2hx mb-4">500 Error: Server Error</h1>
23
+ <!--end::Title-->
24
+ <!--begin::Text-->
25
+ <div class="fw-semibold fs-6 mb-7">We're sorry, a server error has occurred. Please try again later. If the problem persists, please contact us.</div>
26
+ <!--end::Text-->
27
+ <!--begin::Illustration-->
28
+ <div class="mb-3">
29
+ <img src="/build/theme/media/auth/500-error.png" class="mw-100 mh-300px theme-light-show" alt="" />
30
+ <img src="/build/theme/media/auth/500-error-dark.png" class="mw-100 mh-300px theme-dark-show" alt="" />
31
+ </div>
32
+ <!--end::Illustration-->
33
+ <!--begin::Link-->
34
+ <div class="mb-0">
35
+ <a href="/" class="btn btn-sm btn-primary">Back to Home</a>
36
+ </div>
37
+ <!--end::Link-->
38
+ </div>
39
+ </div>
40
+ <!--end::Wrapper-->
41
+ </div>
42
+ <!--end::Content-->
43
+ </div>
44
+ <!--end::Authentication - Signup Welcome Message-->
@@ -23,7 +23,7 @@
23
23
  <!--begin::Body-->
24
24
  <body
25
25
  id="kt_app_body"
26
- {{#if session}}
26
+ {{#if (and (notEmpty session) (neq isErrorPage true))}}
27
27
  data-kt-app-layout="light-sidebar"
28
28
  data-kt-app-header-fixed="true"
29
29
  data-kt-app-sidebar-enabled="true"
@@ -55,7 +55,7 @@
55
55
  }
56
56
  </script>
57
57
  <!--end::Theme mode setup on page load-->
58
- {{#if session}}
58
+ {{#if (and (notEmpty session) (neq isErrorPage true))}}
59
59
  <!--begin::App-->
60
60
  <div class="d-flex flex-column flex-root app-root" id="kt_app_root">
61
61
  <!--begin::Page-->
@@ -70,12 +70,17 @@ export default {
70
70
  * @example
71
71
  * hook_handle_error: (err, req, res, next) => {
72
72
  * if (err.status === 404)
73
- * // If the URL cannot be found, a 404 error screen (views/error-404.hbs) is displayed.
74
- * res.render('error-404');
73
+ * // If the URL cannot be found, a 404 error screen (views/errors/404.hbs) is displayed.
74
+ * res.render('errors/404');
75
75
  * else
76
- * // For other errors, unknown error screen (views/error-unknown.hbs) is displayed.
77
- * res.render('error-unknown');
76
+ * // For other errors, unknown error screen (views/error/500.hbs) is displayed.
77
+ * res.render('error/500');
78
78
  * },
79
79
  */
80
- hook_handle_error: undefined,
80
+ hook_handle_error: (err, req, res, next) => {
81
+ if (err.status === 404)
82
+ res.status(404).render('errors/404', {isErrorPage: true});
83
+ else
84
+ res.status(500).render('errors/500', {isErrorPage: true});
85
+ },
81
86
  }
@@ -6,6 +6,7 @@ import UserNotFound from '../../exceptions/UserNotFound.js';
6
6
  import * as CustomValidation from '../../shared/CustomValidation.js';
7
7
 
8
8
  const router = Router();
9
+
9
10
  router.post('/login', [
10
11
  body('email').trim().not().isEmpty().isEmail(),
11
12
  body('password').trim().not().isEmpty()
@@ -111,4 +112,5 @@ router.put('/profile', [
111
112
  next(err);
112
113
  }
113
114
  });
115
+
114
116
  export default router;
@@ -1,7 +1,9 @@
1
1
  import {Router} from 'express';
2
2
 
3
3
  const router = Router();
4
+
4
5
  router.get('/', (req, res) => {
5
6
  res.render('login');
6
7
  });
8
+
7
9
  export default router;
@@ -2,6 +2,7 @@ import {Router} from 'express';
2
2
  import UserModel from '../models/UserModel.js';
3
3
 
4
4
  const router = Router();
5
+
5
6
  router.get('/', (req, res) => {
6
7
  res.render('users');
7
8
  });
@@ -15,4 +16,5 @@ router.get('/edit-personal', async (req, res) => {
15
16
  const user = await UserModel.getUser(req.user.id);
16
17
  res.render('edit-personal', {user: user.toJSON()});
17
18
  });
19
+
18
20
  export default router;
@@ -0,0 +1,44 @@
1
+ {{!< default}}
2
+ {{#contentFor 'title'}}404 Error: Page Not Found{{/contentFor}}
3
+ {{#contentFor 'style'}}
4
+ <style>
5
+ body {
6
+ background-image: url('/build/theme/media/auth/bg6.jpg');
7
+ }
8
+
9
+ [data-bs-theme="dark"] body {
10
+ background-image: url('/build/theme/media/auth/bg6-dark.jpg');
11
+ }
12
+ </style>
13
+ {{/contentFor}}
14
+ <!--begin::Authentication - Signup Welcome Message -->
15
+ <div class="d-flex flex-column flex-center flex-column-fluid">
16
+ <!--begin::Content-->
17
+ <div class="d-flex flex-column flex-center text-center p-10">
18
+ <!--begin::Wrapper-->
19
+ <div class="card card-flush w-lg-650px py-5">
20
+ <div class="card-body py-15 py-lg-20">
21
+ <!--begin::Title-->
22
+ <h1 class="fw-bolder fs-2hx mb-4">404 Error: Page Not Found</h1>
23
+ <!--end::Title-->
24
+ <!--begin::Text-->
25
+ <div class="fw-semibold fs-6 mb-7">The page you requested could not be found. Please check the URL and try again. If the problem persists, please contact us.</div>
26
+ <!--end::Text-->
27
+ <!--begin::Illustration-->
28
+ <div class="mb-3">
29
+ <img src="/build/theme/media/auth/404-error.png" class="mw-100 mh-300px theme-light-show" alt="" />
30
+ <img src="/build/theme/media/auth/404-error-dark.png" class="mw-100 mh-300px theme-dark-show" alt="" />
31
+ </div>
32
+ <!--end::Illustration-->
33
+ <!--begin::Link-->
34
+ <div class="mb-0">
35
+ <a href="/" class="btn btn-sm btn-primary">Back to Home</a>
36
+ </div>
37
+ <!--end::Link-->
38
+ </div>
39
+ </div>
40
+ <!--end::Wrapper-->
41
+ </div>
42
+ <!--end::Content-->
43
+ </div>
44
+ <!--end::Authentication - Signup Welcome Message-->
@@ -0,0 +1,44 @@
1
+ {{!< default}}
2
+ {{#contentFor 'title'}}500 Error: Server Error{{/contentFor}}
3
+ {{#contentFor 'style'}}
4
+ <style>
5
+ body {
6
+ background-image: url('/build/theme/media/auth/bg6.jpg');
7
+ }
8
+
9
+ [data-bs-theme="dark"] body {
10
+ background-image: url('/build/theme/media/auth/bg6-dark.jpg');
11
+ }
12
+ </style>
13
+ {{/contentFor}}
14
+ <!--begin::Authentication - Signup Welcome Message -->
15
+ <div class="d-flex flex-column flex-center flex-column-fluid">
16
+ <!--begin::Content-->
17
+ <div class="d-flex flex-column flex-center text-center p-10">
18
+ <!--begin::Wrapper-->
19
+ <div class="card card-flush w-lg-650px py-5">
20
+ <div class="card-body py-15 py-lg-20">
21
+ <!--begin::Title-->
22
+ <h1 class="fw-bolder fs-2hx mb-4">500 Error: Server Error</h1>
23
+ <!--end::Title-->
24
+ <!--begin::Text-->
25
+ <div class="fw-semibold fs-6 mb-7">We're sorry, a server error has occurred. Please try again later. If the problem persists, please contact us.</div>
26
+ <!--end::Text-->
27
+ <!--begin::Illustration-->
28
+ <div class="mb-3">
29
+ <img src="/build/theme/media/auth/500-error.png" class="mw-100 mh-300px theme-light-show" alt="" />
30
+ <img src="/build/theme/media/auth/500-error-dark.png" class="mw-100 mh-300px theme-dark-show" alt="" />
31
+ </div>
32
+ <!--end::Illustration-->
33
+ <!--begin::Link-->
34
+ <div class="mb-0">
35
+ <a href="/" class="btn btn-sm btn-primary">Back to Home</a>
36
+ </div>
37
+ <!--end::Link-->
38
+ </div>
39
+ </div>
40
+ <!--end::Wrapper-->
41
+ </div>
42
+ <!--end::Content-->
43
+ </div>
44
+ <!--end::Authentication - Signup Welcome Message-->
@@ -23,7 +23,7 @@
23
23
  <!--begin::Body-->
24
24
  <body
25
25
  id="kt_app_body"
26
- {{#if session}}
26
+ {{#if (and (notEmpty session) (neq isErrorPage true))}}
27
27
  data-kt-app-layout="light-sidebar"
28
28
  data-kt-app-header-fixed="true"
29
29
  data-kt-app-sidebar-enabled="true"
@@ -55,7 +55,7 @@
55
55
  }
56
56
  </script>
57
57
  <!--end::Theme mode setup on page load-->
58
- {{#if session}}
58
+ {{#if (and (notEmpty session) (neq isErrorPage true))}}
59
59
  <!--begin::App-->
60
60
  <div class="d-flex flex-column flex-root app-root" id="kt_app_root">
61
61
  <!--begin::Page-->