express-generator-typescript 1.10.3 → 2.0.2

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 (121) hide show
  1. package/README.md +37 -27
  2. package/bin/cli.js +2 -15
  3. package/lib/cli.js +1 -15
  4. package/lib/express-generator-typescript.js +11 -21
  5. package/lib/project-files/.eslintrc.json +16 -2
  6. package/lib/project-files/build.ts +2 -2
  7. package/lib/project-files/package.json +15 -5
  8. package/lib/project-files/spec/nodemon.json +1 -1
  9. package/lib/{auth-proj → project-files}/spec/support/login-agent.ts +6 -8
  10. package/lib/{auth-proj → project-files}/spec/tests/auth.spec.ts +18 -32
  11. package/lib/project-files/spec/tests/users.spec.ts +31 -22
  12. package/lib/project-files/spec/types/supertest/index.d.ts +14 -0
  13. package/lib/project-files/src/models/user-model.ts +18 -3
  14. package/lib/project-files/src/pre-start/env/development.env +9 -0
  15. package/lib/project-files/src/pre-start/env/production.env +10 -0
  16. package/lib/project-files/src/pre-start/env/test.env +9 -0
  17. package/lib/{auth-proj → project-files}/src/public/scripts/http.js +0 -0
  18. package/lib/{auth-proj → project-files}/src/public/scripts/login.js +0 -0
  19. package/lib/{auth-proj → project-files}/src/public/scripts/users.js +0 -0
  20. package/lib/{auth-proj → project-files}/src/public/stylesheets/login.css +0 -0
  21. package/lib/{auth-proj → project-files}/src/public/stylesheets/users.css +0 -0
  22. package/lib/project-files/src/repos/mock-orm.ts +2 -2
  23. package/lib/project-files/src/repos/user-repo.ts +1 -1
  24. package/lib/project-files/src/routes/api.ts +9 -6
  25. package/lib/{socket-io → project-files}/src/routes/auth-router.ts +14 -15
  26. package/lib/{auth-proj → project-files}/src/routes/middleware.ts +10 -8
  27. package/lib/project-files/src/routes/user-router.ts +9 -15
  28. package/lib/project-files/src/server.ts +82 -73
  29. package/lib/{auth-proj → project-files}/src/services/auth-service.ts +1 -1
  30. package/lib/project-files/src/services/user-service.ts +9 -9
  31. package/lib/project-files/src/shared/env-vars.ts +18 -0
  32. package/lib/project-files/src/shared/errors.ts +11 -0
  33. package/lib/project-files/src/shared/types.ts +14 -0
  34. package/lib/project-files/src/types/express/index.d.ts +16 -8
  35. package/lib/{socket-io → project-files}/src/util/jwt-util.ts +10 -9
  36. package/lib/{auth-proj → project-files}/src/views/login.html +0 -0
  37. package/lib/{auth-proj → project-files}/src/views/users.html +0 -0
  38. package/lib/project-files/tsconfig.json +3 -0
  39. package/package.json +1 -1
  40. package/chat-screenshot.png +0 -0
  41. package/lib/auth-proj/.eslintignore +0 -1
  42. package/lib/auth-proj/.eslintrc.json +0 -27
  43. package/lib/auth-proj/build.ts +0 -64
  44. package/lib/auth-proj/gitignore +0 -3
  45. package/lib/auth-proj/package.json +0 -73
  46. package/lib/auth-proj/spec/index.ts +0 -57
  47. package/lib/auth-proj/spec/loadEnv.ts +0 -10
  48. package/lib/auth-proj/spec/nodemon.json +0 -6
  49. package/lib/auth-proj/spec/support/jasmine.json +0 -11
  50. package/lib/auth-proj/spec/tests/users.spec.ts +0 -283
  51. package/lib/auth-proj/src/index.ts +0 -14
  52. package/lib/auth-proj/src/models/user-model.ts +0 -56
  53. package/lib/auth-proj/src/pre-start/env/development.env +0 -23
  54. package/lib/auth-proj/src/pre-start/env/production.env +0 -24
  55. package/lib/auth-proj/src/pre-start/env/test.env +0 -23
  56. package/lib/auth-proj/src/pre-start/index.ts +0 -28
  57. package/lib/auth-proj/src/repos/database.json +0 -1
  58. package/lib/auth-proj/src/repos/mock-orm.ts +0 -41
  59. package/lib/auth-proj/src/repos/user-repo.ts +0 -88
  60. package/lib/auth-proj/src/routes/api.ts +0 -17
  61. package/lib/auth-proj/src/routes/auth-router.ts +0 -63
  62. package/lib/auth-proj/src/routes/user-router.ts +0 -80
  63. package/lib/auth-proj/src/server.ts +0 -82
  64. package/lib/auth-proj/src/services/user-service.ts +0 -52
  65. package/lib/auth-proj/src/shared/env-vars.ts +0 -20
  66. package/lib/auth-proj/src/shared/errors.ts +0 -45
  67. package/lib/auth-proj/src/shared/functions.ts +0 -18
  68. package/lib/auth-proj/src/types/express/index.d.ts +0 -32
  69. package/lib/auth-proj/src/util/jwt-util.ts +0 -47
  70. package/lib/auth-proj/tsconfig.json +0 -100
  71. package/lib/auth-proj/tsconfig.prod.json +0 -11
  72. package/lib/project-files/src/public/scripts/index.js +0 -183
  73. package/lib/project-files/src/public/stylesheets/style.css +0 -33
  74. package/lib/project-files/src/views/index.html +0 -31
  75. package/lib/socket-io/.eslintignore +0 -1
  76. package/lib/socket-io/.eslintrc.json +0 -27
  77. package/lib/socket-io/build.ts +0 -64
  78. package/lib/socket-io/gitignore +0 -3
  79. package/lib/socket-io/package.json +0 -75
  80. package/lib/socket-io/spec/index.ts +0 -57
  81. package/lib/socket-io/spec/loadEnv.ts +0 -10
  82. package/lib/socket-io/spec/nodemon.json +0 -6
  83. package/lib/socket-io/spec/support/jasmine.json +0 -11
  84. package/lib/socket-io/spec/support/login-agent.ts +0 -49
  85. package/lib/socket-io/spec/tests/auth.spec.ts +0 -159
  86. package/lib/socket-io/spec/tests/chat.spec.ts +0 -150
  87. package/lib/socket-io/spec/tests/users.spec.ts +0 -283
  88. package/lib/socket-io/src/index.ts +0 -14
  89. package/lib/socket-io/src/models/user-model.ts +0 -56
  90. package/lib/socket-io/src/pre-start/env/development.env +0 -23
  91. package/lib/socket-io/src/pre-start/env/production.env +0 -24
  92. package/lib/socket-io/src/pre-start/env/test.env +0 -23
  93. package/lib/socket-io/src/pre-start/index.ts +0 -28
  94. package/lib/socket-io/src/public/scripts/chat.js +0 -87
  95. package/lib/socket-io/src/public/scripts/http.js +0 -24
  96. package/lib/socket-io/src/public/scripts/index.js +0 -16
  97. package/lib/socket-io/src/public/scripts/login.js +0 -17
  98. package/lib/socket-io/src/public/scripts/users.js +0 -148
  99. package/lib/socket-io/src/public/stylesheets/chat.css +0 -43
  100. package/lib/socket-io/src/public/stylesheets/index.css +0 -13
  101. package/lib/socket-io/src/public/stylesheets/login.css +0 -20
  102. package/lib/socket-io/src/public/stylesheets/users.css +0 -40
  103. package/lib/socket-io/src/repos/database.json +0 -38
  104. package/lib/socket-io/src/repos/mock-orm.ts +0 -41
  105. package/lib/socket-io/src/repos/user-repo.ts +0 -88
  106. package/lib/socket-io/src/routes/api.ts +0 -19
  107. package/lib/socket-io/src/routes/chat-router.ts +0 -97
  108. package/lib/socket-io/src/routes/middleware.ts +0 -55
  109. package/lib/socket-io/src/routes/user-router.ts +0 -77
  110. package/lib/socket-io/src/server.ts +0 -100
  111. package/lib/socket-io/src/services/auth-service.ts +0 -38
  112. package/lib/socket-io/src/services/user-service.ts +0 -52
  113. package/lib/socket-io/src/shared/env-vars.ts +0 -20
  114. package/lib/socket-io/src/shared/errors.ts +0 -56
  115. package/lib/socket-io/src/shared/functions.ts +0 -18
  116. package/lib/socket-io/src/types/express/index.d.ts +0 -34
  117. package/lib/socket-io/src/views/chat.html +0 -51
  118. package/lib/socket-io/src/views/login.html +0 -35
  119. package/lib/socket-io/src/views/users.html +0 -47
  120. package/lib/socket-io/tsconfig.json +0 -100
  121. package/lib/socket-io/tsconfig.prod.json +0 -11
@@ -1,97 +0,0 @@
1
- import SocketIO from 'socket.io';
2
- import StatusCodes from 'http-status-codes';
3
- import { Router, Request, Response } from 'express';
4
-
5
- import { ParamMissingError, RoomNotFoundError } from '@shared/errors';
6
- import { IReq } from 'src/types/express';
7
-
8
-
9
- // **** Variables **** //
10
-
11
- // Chat router
12
- const router = Router();
13
- const { OK } = StatusCodes;
14
-
15
- // Paths
16
- export const p = {
17
- connect: '/connect-socket-room/:socketId',
18
- emit: '/emit-message',
19
- } as const;
20
-
21
- export const socketRoomName = 'jet-logger-chat-room';
22
-
23
-
24
- // **** Types **** //
25
-
26
- interface IPostMsg {
27
- message: string;
28
- socketId: string;
29
- }
30
-
31
-
32
- // **** Routes **** //
33
-
34
- /**
35
- * Connect to socket room.
36
- */
37
- router.get(p.connect, async (req: Request, res: Response) => {
38
- const { socketId } = req.params;
39
- // Check params
40
- if (!socketId) {
41
- throw new ParamMissingError();
42
- }
43
- // Get socket
44
- const socket = getSocket(req, socketId);
45
- // Connect
46
- await Promise.all([
47
- socket.leave(socketRoomName),
48
- socket.join(socketRoomName),
49
- ]);
50
- // Return
51
- return res.status(OK).end();
52
- });
53
-
54
- /**
55
- * Send a chat message.
56
- */
57
- router.post(p.emit, (req: IReq<IPostMsg>, res: Response) => {
58
- const { sessionUser } = res.locals;
59
- const { message, socketId } = req.body;
60
- // Check params
61
- if (!socketId || !message) {
62
- throw new ParamMissingError();
63
- }
64
- // Get socket
65
- const socket = getSocket(req, socketId);
66
- // Connect
67
- const room = socket.to(socketRoomName);
68
- room.emit('emit-msg', {
69
- timestamp: Date.now(),
70
- content: message,
71
- senderName: sessionUser.name,
72
- });
73
- // Return
74
- return res.status(OK).json({
75
- senderName: sessionUser.name,
76
- });
77
- });
78
-
79
-
80
- // **** Helpers **** //
81
-
82
- /**
83
- * Get the socket from the Express request object.
84
- */
85
- function getSocket(req: Request, socketId: string): SocketIO.Socket {
86
- const io = req.app.get('socketio') as SocketIO.Server;
87
- const socket = io.sockets.sockets.get(socketId);
88
- if (!socket) {
89
- throw new RoomNotFoundError();
90
- }
91
- return socket;
92
- }
93
-
94
-
95
- // **** Export default **** //
96
-
97
- export default router;
@@ -1,55 +0,0 @@
1
- import StatusCodes from 'http-status-codes';
2
- import { Request, Response, NextFunction } from 'express';
3
- import { JwtPayload } from 'jsonwebtoken';
4
-
5
- import envVars from '@shared/env-vars';
6
- import { IUser } from '@models/user-model';
7
- import jwtUtil from '@util/jwt-util';
8
-
9
-
10
- // **** Variables **** //
11
-
12
- const { UNAUTHORIZED } = StatusCodes;
13
- const jwtNotPresentErr = 'JWT not present in signed cookie.';
14
-
15
-
16
- // **** Types **** //
17
-
18
- export interface ISessionUser extends JwtPayload {
19
- id: number;
20
- email: string;
21
- name: string;
22
- role: IUser['role'];
23
- }
24
-
25
-
26
- // **** Functions **** //
27
-
28
- /**
29
- * Middleware to verify if user is logged in.
30
- */
31
- export async function authMw(req: Request, res: Response, next: NextFunction) {
32
- try {
33
- // Get json-web-token
34
- const jwt = req.signedCookies[envVars.cookieProps.key];
35
- if (!jwt) {
36
- throw Error(jwtNotPresentErr);
37
- }
38
- // Make sure user role is an admin
39
- const clientData = await jwtUtil.decode<ISessionUser>(jwt);
40
- if (!!clientData) {
41
- res.locals.sessionUser = clientData;
42
- next();
43
- } else {
44
- throw Error(jwtNotPresentErr);
45
- }
46
- } catch (err) {
47
- let error;
48
- if (typeof err === 'string') {
49
- error = err;
50
- } else if (err instanceof Error) {
51
- error = err.message;
52
- }
53
- return res.status(UNAUTHORIZED).json({ error });
54
- }
55
- }
@@ -1,77 +0,0 @@
1
- import StatusCodes from 'http-status-codes';
2
- import { Request, Response, Router } from 'express';
3
-
4
- import userService from '@services/user-service';
5
- import { ParamMissingError } from '@shared/errors';
6
- import { IReq } from 'src/types/express';
7
- import { IUser } from '@models/user-model';
8
-
9
-
10
- // **** Variables **** //
11
-
12
- // Constants
13
- const router = Router();
14
- const { CREATED, OK } = StatusCodes;
15
-
16
- // Paths
17
- export const p = {
18
- get: '/all',
19
- add: '/add',
20
- update: '/update',
21
- delete: '/delete/:id',
22
- } as const;
23
-
24
-
25
- // **** Routes **** //
26
-
27
- /**
28
- * Get all users.
29
- */
30
- router.get(p.get, async (_: Request, res: Response) => {
31
- const users = await userService.getAll();
32
- return res.status(OK).json({users});
33
- });
34
-
35
- /**
36
- * Add one user.
37
- */
38
- router.post(p.add, async (req: IReq<{user: IUser}>, res: Response) => {
39
- const { user } = req.body;
40
- if (!user) {
41
- throw new ParamMissingError();
42
- }
43
- // Fetch data
44
- await userService.addOne(user);
45
- return res.status(CREATED).end();
46
- });
47
-
48
- /**
49
- * Update one user.
50
- */
51
- router.put(p.update, async (req: IReq<{user: IUser}>, res: Response) => {
52
- const { user } = req.body;
53
- if (!user) {
54
- throw new ParamMissingError();
55
- }
56
- // Fetch data
57
- await userService.updateOne(user);
58
- return res.status(OK).end();
59
- });
60
-
61
- /**
62
- * Delete one user.
63
- */
64
- router.delete(p.delete, async (req: Request, res: Response) => {
65
- const { id } = req.params;
66
- if (!id) {
67
- throw new ParamMissingError();
68
- }
69
- // Fetch data
70
- await userService.delete(Number(id));
71
- return res.status(OK).end();
72
- });
73
-
74
-
75
- // **** Export default **** //
76
-
77
- export default router;
@@ -1,100 +0,0 @@
1
- import cookieParser from 'cookie-parser';
2
- import morgan from 'morgan';
3
- import path from 'path';
4
- import http from 'http';
5
- import helmet from 'helmet';
6
- import StatusCodes from 'http-status-codes';
7
- import { Server as SocketIo } from 'socket.io';
8
- import express, { NextFunction, Request, Response } from 'express';
9
-
10
- import 'express-async-errors';
11
-
12
- import BaseRouter from './routes/api';
13
- import logger from 'jet-logger';
14
- import envVars from '@shared/env-vars';
15
- import { CustomError } from '@shared/errors';
16
-
17
-
18
- // **** Init express **** //
19
-
20
- const app = express();
21
-
22
-
23
- // **** Set basic express settings **** //
24
-
25
- app.use(express.json());
26
- app.use(express.urlencoded({extended: true}));
27
- app.use(cookieParser(envVars.cookieProps.secret));
28
-
29
- // Show routes called in console during development
30
- if (envVars.nodeEnv === 'development') {
31
- app.use(morgan('dev'));
32
- }
33
-
34
- // Security
35
- if (envVars.nodeEnv === 'production') {
36
- app.use(helmet());
37
- }
38
-
39
- // Add APIs
40
- app.use('/api', BaseRouter);
41
-
42
- // Error handling
43
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
44
- app.use((err: Error | CustomError, req: Request, res: Response, _: NextFunction) => {
45
- logger.err(err, true);
46
- const status = (err instanceof CustomError ? err.HttpStatus : StatusCodes.BAD_REQUEST);
47
- return res.status(status).json({
48
- error: err.message,
49
- });
50
- });
51
-
52
-
53
- // **** Serve front-end content **** //
54
-
55
- const viewsDir = path.join(__dirname, 'views');
56
- app.set('views', viewsDir);
57
- const staticDir = path.join(__dirname, 'public');
58
- app.use(express.static(staticDir));
59
-
60
- // Login page
61
- app.get('/', (_: Request, res: Response) => {
62
- return res.sendFile('login.html', {root: viewsDir});
63
- });
64
-
65
- // Users page
66
- app.get('/users', (req: Request, res: Response) => {
67
- const jwt = req.signedCookies[envVars.cookieProps.key];
68
- if (!jwt) {
69
- return res.redirect('/');
70
- } else {
71
- return res.sendFile('users.html', {root: viewsDir});
72
- }
73
- });
74
-
75
- // Chat page
76
- app.get('/chat', (req: Request, res: Response) => {
77
- const jwt = req.signedCookies[envVars.cookieProps.key];
78
- if (!jwt) {
79
- return res.redirect('/');
80
- } else {
81
- return res.sendFile('chat.html', {root: viewsDir});
82
- }
83
- });
84
-
85
-
86
- // **** Setup Socket.io **** //
87
-
88
- // Tutorial used for this: https://www.valentinog.com/blog/socket-react/
89
-
90
- const server = http.createServer(app);
91
- const io = new SocketIo(server);
92
-
93
- io.sockets.on('connect', () => {
94
- return app.set('socketio', io);
95
- });
96
-
97
-
98
- // **** Export default **** //
99
-
100
- export default server;
@@ -1,38 +0,0 @@
1
- import bcrypt from 'bcrypt';
2
-
3
- import userRepo from '@repos/user-repo';
4
- import jwtUtil from '@util/jwt-util';
5
- import { UnauthorizedError } from '@shared/errors';
6
-
7
-
8
- // **** Functions **** //
9
-
10
- /**
11
- * Login
12
- */
13
- async function login(email: string, password: string): Promise<string> {
14
- // Fetch user
15
- const user = await userRepo.getOne(email);
16
- if (!user) {
17
- throw new UnauthorizedError();
18
- }
19
- // Check password
20
- const pwdPassed = await bcrypt.compare(password, user.pwdHash);
21
- if (!pwdPassed) {
22
- throw new UnauthorizedError();
23
- }
24
- // Setup Admin Cookie
25
- return jwtUtil.sign({
26
- id: user.id,
27
- email: user.name,
28
- name: user.name,
29
- role: user.role,
30
- });
31
- }
32
-
33
-
34
- // **** Export default **** //
35
-
36
- export default {
37
- login,
38
- } as const;
@@ -1,52 +0,0 @@
1
- import userRepo from '@repos/user-repo';
2
- import { IUser } from '@models/user-model';
3
- import { UserNotFoundError } from '@shared/errors';
4
-
5
-
6
- // **** Functions **** //
7
-
8
- /**
9
- * Get all users.
10
- */
11
- function getAll(): Promise<IUser[]> {
12
- return userRepo.getAll();
13
- }
14
-
15
- /**
16
- * Add one user
17
- */
18
- function addOne(user: IUser): Promise<void> {
19
- return userRepo.add(user);
20
- }
21
-
22
- /**
23
- * Update one user
24
- */
25
- async function updateOne(user: IUser): Promise<void> {
26
- const persists = await userRepo.persists(user.id);
27
- if (!persists) {
28
- throw new UserNotFoundError();
29
- }
30
- return userRepo.update(user);
31
- }
32
-
33
- /**
34
- * Delete a user by their id.
35
- */
36
- async function _delete(id: number): Promise<void> {
37
- const persists = await userRepo.persists(id);
38
- if (!persists) {
39
- throw new UserNotFoundError();
40
- }
41
- return userRepo.delete(id);
42
- }
43
-
44
-
45
- // **** Export default **** //
46
-
47
- export default {
48
- getAll,
49
- addOne,
50
- updateOne,
51
- delete: _delete,
52
- } as const;
@@ -1,20 +0,0 @@
1
- export default {
2
- nodeEnv: (process.env.NODE_ENV ?? ''),
3
- port: (process.env.PORT ?? 0),
4
- cookieProps: {
5
- key: 'ExpressGeneratorTs',
6
- secret: (process.env.COOKIE_SECRET ?? ''),
7
- options: {
8
- httpOnly: true,
9
- signed: true,
10
- path: (process.env.COOKIE_PATH ?? ''),
11
- maxAge: Number(process.env.COOKIE_EXP ?? 0),
12
- domain: (process.env.COOKIE_DOMAIN ?? ''),
13
- secure: (process.env.SECURE_COOKIE === 'true'),
14
- },
15
- },
16
- jwt: {
17
- secret: (process.env.JWT_SECRET ?? ''),
18
- exp: (process.env.COOKIE_EXP ?? ''), // exp at the same time as the cookie
19
- },
20
- } as const;
@@ -1,56 +0,0 @@
1
- import HttpStatusCodes from 'http-status-codes';
2
-
3
-
4
- export abstract class CustomError extends Error {
5
-
6
- public readonly HttpStatus = HttpStatusCodes.BAD_REQUEST;
7
-
8
- constructor(msg: string, httpStatus: number) {
9
- super(msg);
10
- this.HttpStatus = httpStatus;
11
- }
12
- }
13
-
14
-
15
- export class ParamMissingError extends CustomError {
16
-
17
- public static readonly Msg = 'One or more of the required parameters was missing.';
18
- public static readonly HttpStatus = HttpStatusCodes.BAD_REQUEST;
19
-
20
- constructor() {
21
- super(ParamMissingError.Msg, ParamMissingError.HttpStatus);
22
- }
23
- }
24
-
25
-
26
- export class UserNotFoundError extends CustomError {
27
-
28
- public static readonly Msg = 'A user with the given id does not exists in the database.';
29
- public static readonly HttpStatus = HttpStatusCodes.NOT_FOUND;
30
-
31
- constructor() {
32
- super(UserNotFoundError.Msg, UserNotFoundError.HttpStatus);
33
- }
34
- }
35
-
36
-
37
- export class UnauthorizedError extends CustomError {
38
-
39
- public static readonly Msg = 'Login failed';
40
- public static readonly HttpStatus = HttpStatusCodes.UNAUTHORIZED;
41
-
42
- constructor() {
43
- super(UnauthorizedError.Msg, UnauthorizedError.HttpStatus);
44
- }
45
- }
46
-
47
-
48
- export class RoomNotFoundError extends CustomError {
49
-
50
- public static readonly Msg = 'socket room not found on socket server.';
51
- public static readonly HttpStatus = HttpStatusCodes.BAD_REQUEST;
52
-
53
- constructor() {
54
- super(RoomNotFoundError.Msg, RoomNotFoundError.HttpStatus);
55
- }
56
- }
@@ -1,18 +0,0 @@
1
- import logger from 'jet-logger';
2
-
3
-
4
- /**
5
- * Print an error object if it's truthy. Useful for testing.
6
- */
7
- export function pErr(err?: Error): void {
8
- if (!!err) {
9
- logger.err(err);
10
- }
11
- }
12
-
13
- /**
14
- * Get a random number between 1 and 1,000,000,000,000.
15
- */
16
- export function getRandomInt(): number {
17
- return Math.floor(Math.random() * 1_000_000_000_000);
18
- }
@@ -1,34 +0,0 @@
1
- import 'express';
2
- import * as e from 'express';
3
- import { Query } from 'express-serve-static-core';
4
-
5
- import { ISessionUser } from '@routes/middleware';
6
-
7
-
8
-
9
- // **** Declaration Merging **** //
10
-
11
- declare module 'express' {
12
-
13
- export interface Request {
14
- signedCookies: Record<string, string>;
15
- }
16
-
17
- export interface Response {
18
- locals: {
19
- sessionUser: ISessionUser;
20
- };
21
- }
22
- }
23
-
24
-
25
- // **** Generics for Request Object **** //
26
-
27
- export interface IReq<T> extends e.Request {
28
- body: T;
29
- }
30
-
31
- export interface IReqQuery<T extends Query, U = void> extends e.Request {
32
- query: T;
33
- body?: U;
34
- }
@@ -1,51 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Users</title>
6
- <link rel="stylesheet" type="text/css" href="/stylesheets/index.css" />
7
- <link rel="stylesheet" type="text/css" href="/stylesheets/chat.css" />
8
- <script
9
- src="https://cdn.socket.io/3.1.3/socket.io.min.js"
10
- integrity="sha384-cPwlPLvBTa3sKAgddT6krw0cJat7egBga3DJepJyrLl4Q9/5WLra3rrnMcyTyOnh"
11
- crossorigin="anonymous"
12
- ></script>
13
- <script
14
- src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"
15
- integrity="sha512-qTXRIMyZIFb8iQcfjXWCO8+M5Tbc38Qi5WzdPOYZHIlZpzBHG3L3by84BBBOiRGiEb7KKtAOAs5qYdUiZiQNNQ=="
16
- crossorigin="anonymous"
17
- referrerpolicy="no-referrer"
18
- ></script>
19
- <script src="scripts/http.js"></script>
20
- </head>
21
- <body>
22
-
23
- <!-- Header -->
24
- <div class="main-header">
25
- <button class="header-button nav-users-btn">
26
- Users
27
- </button>
28
- <button class="header-button nav-chat-btn">
29
- Chat
30
- </button>
31
- <button class="header-button logout-btn">
32
- Logout
33
- </button>
34
- </div>
35
-
36
- <!-- Chat Window -->
37
- <div id="window-wrapper">
38
- Chat Window
39
- <div id="chat-window"></div>
40
-
41
- <div id="send-msg-wrapper">
42
- <input id="send-msg-input"/>
43
- <button id="send-msg-btn">
44
- Send
45
- </button>
46
- </div>
47
- </div>
48
- </body>
49
- <script src="scripts/index.js"></script>
50
- <script src="scripts/chat.js"></script>
51
- </html>
@@ -1,35 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Login</title>
6
- <link rel="stylesheet" type="text/css" href="/stylesheets/index.css" />
7
- <link rel="stylesheet" type="text/css" href="/stylesheets/login.css" />
8
- </head>
9
- <body>
10
-
11
- <div class="login-block">
12
- <div class="login-header">
13
- Login
14
- </div>
15
- <div class="login-input">
16
- Username:<br/>
17
- <input id="email-input" type="text"/>
18
- </div>
19
- <div class="login-input">
20
- Password:<br/>
21
- <input id="pwd-input" type="password"/>
22
- </div>
23
- <div>
24
- <button id="login-btn">Login</button>
25
- </div>
26
- <div class="default-login-user">
27
- Default admin user (Email: "sean.maxwell@gmail.com", Password: "Password@1")
28
- </div>
29
- </div>
30
-
31
- </body>
32
- <script src="scripts/http.js"></script>
33
- <script src="scripts/index.js"></script>
34
- <script src="scripts/login.js"></script>
35
- </html>
@@ -1,47 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <title>Users</title>
6
- <link rel="stylesheet" type="text/css" href="/stylesheets/index.css" />
7
- <link rel="stylesheet" type="text/css" href="/stylesheets/users.css" />
8
- <script src="scripts/http.js"></script>
9
- </head>
10
- <body>
11
-
12
- <!-- Header -->
13
- <div class="main-header">
14
- <button class="header-button nav-users-btn">
15
- Users
16
- </button>
17
- <button class="header-button nav-chat-btn">
18
- Chat
19
- </button>
20
- <button class="header-button logout-btn">
21
- Logout
22
- </button>
23
- </div>
24
-
25
- <!-- Add Users -->
26
- <div class="users-column add-user-col">
27
- <div class="column-header">Add User:</div>
28
- <div>
29
- <input id="name-input" placeholder="Name">
30
- </div>
31
- <div>
32
- <input id="email-input" placeholder="Email">
33
- </div>
34
- <div>
35
- <button id="add-user-btn">Add</button>
36
- </div>
37
- </div>
38
-
39
- <!-- Display Users -->
40
- <div class="users-column">
41
- <div class="column-header">Users:</div>
42
- <div id="all-users-anchor"></div>
43
- </div>
44
- </body>
45
- <script src="scripts/index.js"></script>
46
- <script src="scripts/users.js"></script>
47
- </html>