express-generator-typescript 2.4.7 → 2.4.8

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.
Files changed (33) hide show
  1. package/lib/express-generator-typescript.js +1 -1
  2. package/lib/project-files/package.json +2 -1
  3. package/lib/project-files/spec/support/apiCb.ts +76 -0
  4. package/lib/project-files/spec/tests/users.spec.ts +98 -135
  5. package/lib/project-files/spec/types/misc.ts +18 -0
  6. package/lib/project-files/src/models/User.ts +13 -27
  7. package/lib/project-files/src/public/scripts/http.js +3 -1
  8. package/lib/project-files/src/public/scripts/users.js +31 -65
  9. package/lib/project-files/src/public/stylesheets/users.css +4 -6
  10. package/lib/project-files/src/repos/UserRepo.ts +6 -1
  11. package/lib/project-files/src/repos/database.json +22 -1
  12. package/lib/project-files/src/routes/types/express/misc.ts +1 -5
  13. package/lib/project-files/src/routes/types/types.ts +0 -8
  14. package/lib/project-files/src/views/users.html +100 -5
  15. package/lib/project-files-auth/package.json +2 -1
  16. package/lib/project-files-auth/spec/support/apiCb.ts +76 -0
  17. package/lib/project-files-auth/spec/support/login.ts +3 -6
  18. package/lib/project-files-auth/spec/tests/auth.spec.ts +50 -67
  19. package/lib/project-files-auth/spec/tests/users.spec.ts +98 -142
  20. package/lib/project-files-auth/spec/types/misc.ts +18 -0
  21. package/lib/project-files-auth/src/models/User.ts +17 -12
  22. package/lib/project-files-auth/src/public/scripts/http.js +3 -1
  23. package/lib/project-files-auth/src/public/scripts/login.js +1 -3
  24. package/lib/project-files-auth/src/public/scripts/users.js +31 -63
  25. package/lib/project-files-auth/src/public/stylesheets/users.css +4 -11
  26. package/lib/project-files-auth/src/repos/UserRepo.ts +6 -1
  27. package/lib/project-files-auth/src/repos/database.json +1 -1
  28. package/lib/project-files-auth/src/services/UserService.ts +2 -8
  29. package/lib/project-files-auth/src/views/login.html +26 -3
  30. package/lib/project-files-auth/src/views/users.html +106 -8
  31. package/package.json +1 -1
  32. package/lib/project-files/spec/support/types.ts +0 -1
  33. package/lib/project-files-auth/spec/support/types.ts +0 -1
@@ -1,10 +1,30 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
+
4
+ <!-- Head -->
3
5
  <head>
4
6
  <meta charset="UTF-8">
5
7
  <title>Login</title>
6
8
  <link rel="stylesheet" type="text/css" href="/stylesheets/login.css" />
9
+
10
+ <!-- Handlebars -->
11
+ <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.min.js"></script>
12
+
13
+ <!-- Bootstrap -->
14
+ <link
15
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
16
+ rel="stylesheet"
17
+ integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
18
+ crossorigin="anonymous"
19
+ />
20
+ <script
21
+ src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
22
+ integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
23
+ crossorigin="anonymous"
24
+ ></script>
7
25
  </head>
26
+
27
+ <!-- Body -->
8
28
  <body>
9
29
 
10
30
  <div class="login-block">
@@ -12,16 +32,18 @@
12
32
 
13
33
  <div class="login-input">
14
34
  Username:<br/>
15
- <input id="email-input" type="text"/>
35
+ <input id="email-input" type="text" class="form-control"/>
16
36
  </div>
17
37
 
18
38
  <div class="login-input">
19
39
  Password:<br/>
20
- <input id="pwd-input" type="password"/>
40
+ <input id="pwd-input" type="password" class="form-control"/>
21
41
  </div>
22
42
 
23
43
  <div>
24
- <button id="login-btn">Login</button>
44
+ <button id="login-btn" class="btn btn-primary">
45
+ Login
46
+ </button>
25
47
  </div>
26
48
 
27
49
  <div class="default-login-user">
@@ -30,6 +52,7 @@
30
52
  </div>
31
53
 
32
54
  </body>
55
+
33
56
  <script src="scripts/http.js"></script>
34
57
  <script src="scripts/login.js"></script>
35
58
  </html>
@@ -1,10 +1,30 @@
1
1
  <!DOCTYPE html>
2
2
  <html lang="en">
3
+
4
+ <!-- Head -->
3
5
  <head>
4
6
  <meta charset="UTF-8">
5
7
  <title>Users</title>
6
8
  <link rel="stylesheet" type="text/css" href="/stylesheets/users.css" />
9
+
10
+ <!-- Handlebars -->
11
+ <script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.7.8/handlebars.min.js"></script>
12
+
13
+ <!-- Bootstrap -->
14
+ <link
15
+ href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
16
+ rel="stylesheet"
17
+ integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
18
+ crossorigin="anonymous"
19
+ />
20
+ <script
21
+ src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"
22
+ integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz"
23
+ crossorigin="anonymous"
24
+ ></script>
7
25
  </head>
26
+
27
+ <!-- Body -->
8
28
  <body>
9
29
 
10
30
  <!-- Add Users -->
@@ -13,18 +33,32 @@
13
33
  Add User:
14
34
  </div>
15
35
  <div>
16
- <input id="name-input" placeholder="Name" />
36
+ <input
37
+ id="name-input"
38
+ type="text"
39
+ class="form-control"
40
+ placeholder="Name"
41
+ />
17
42
  </div>
18
43
  <div>
19
- <input id="email-input" placeholder="Email" />
44
+ <input
45
+ id="email-input"
46
+ type="email"
47
+ class="form-control"
48
+ placeholder="Email"
49
+ />
20
50
  </div>
21
51
  <div>
22
- <button id="add-user-btn">
52
+ <button
53
+ id="add-user-btn"
54
+ class="btn btn-success"
55
+ >
23
56
  Add
24
57
  </button>
25
- </div>
26
- <div>
27
- <button id="logout-btn">
58
+ <button
59
+ id="logout-btn"
60
+ class="btn btn-secondary"
61
+ >
28
62
  Logout
29
63
  </button>
30
64
  </div>
@@ -32,11 +66,75 @@
32
66
 
33
67
  <!-- Display Users -->
34
68
  <div class="users-column">
35
- <div class="column-header">Users:</div>
69
+ <div class="column-header">
70
+ Users:
71
+ </div>
72
+
36
73
  <div id="all-users-anchor"></div>
37
- </div>
74
+ <script
75
+ id="all-users-template"
76
+ type="text/x-handlebars-template"
77
+ >
78
+ {{#each users}}
79
+ <div class="user-display-ele">
80
+ <div class="normal-view">
81
+ <div class="display-wrapper">
82
+ <div><b>Name:</b> {{name}}</div>
83
+ <div><b>Email:</b> {{email}}</div>
84
+ <div><b>Created:</b> {{createdFormatted}}</div>
85
+ </div>
86
+ <button
87
+ type="button"
88
+ class="btn btn-primary edit-user-btn"
89
+ data-user-id="{{id}}"
90
+ >
91
+ Edit
92
+ </button>
93
+ <button
94
+ class="btn btn-danger delete-user-btn"
95
+ data-user-id="{{id}}"
96
+ >
97
+ Delete
98
+ </button>
99
+ </div>
38
100
 
101
+ <div class="edit-view">
102
+ <div>
103
+ Name:&nbsp;
104
+ <input
105
+ type="text"
106
+ class="form-control name-edit-input"
107
+ value="{{name}}"
108
+ />
109
+ </div>
110
+ <div class="email-edit">
111
+ Email:&nbsp;
112
+ <input
113
+ type="email"
114
+ class="form-control email-edit-input"
115
+ value="{{email}}"
116
+ />
117
+ </div>
118
+ <button
119
+ class="btn btn-primary submit-edit-btn"
120
+ data-user-id="{{id}}"
121
+ data-user-created="{{created}}"
122
+ >
123
+ Submit
124
+ </button>
125
+ <button
126
+ class="btn btn-secondary cancel-edit-btn"
127
+ data-user-id="{{id}}"
128
+ >
129
+ Cancel
130
+ </button>
131
+ </div>
132
+ </div>
133
+ {{/each}}
134
+ </script>
135
+ </div>
39
136
  </body>
137
+
40
138
  <script src="scripts/http.js"></script>
41
139
  <script src="scripts/users.js"></script>
42
140
  </html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "2.4.7",
3
+ "version": "2.4.8",
4
4
  "description": "Generate new Express applications similar to express-generate which but sets it up to use TypeScript instead",
5
5
  "scripts": {
6
6
  "express-generator-typescript": "node bin/cli.js",
@@ -1 +0,0 @@
1
- export type TReqBody = string | object | undefined;
@@ -1 +0,0 @@
1
- export type TReqBody = string | object | undefined;