express-generator-typescript 2.7.10 → 2.7.12

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 (46) hide show
  1. package/lib/express-generator-typescript.js +44 -11
  2. package/lib/project-files/.prettierignore +12 -0
  3. package/lib/project-files/.prettierrc.json +15 -0
  4. package/lib/project-files/README.md +58 -65
  5. package/lib/project-files/config/.env.development +3 -3
  6. package/lib/project-files/config/.env.production +3 -3
  7. package/lib/project-files/config/.env.test +3 -3
  8. package/lib/project-files/config.ts +20 -22
  9. package/lib/project-files/eslint.config.ts +46 -100
  10. package/lib/project-files/package.json +59 -56
  11. package/lib/project-files/scripts/build.ts +23 -28
  12. package/lib/project-files/scripts/common/utils.ts +11 -11
  13. package/lib/project-files/src/common/constants/HttpStatusCodes.ts +393 -0
  14. package/lib/project-files/src/common/constants/{PATHS.ts → Paths.ts} +15 -15
  15. package/lib/project-files/src/common/constants/{ENV.ts → env.ts} +28 -19
  16. package/lib/project-files/src/common/{util/misc.ts → utils/number-utils.ts} +10 -11
  17. package/lib/project-files/src/common/{util → utils}/route-errors.ts +35 -38
  18. package/lib/project-files/src/common/{util → utils}/validators.ts +14 -14
  19. package/lib/project-files/src/{index.ts → main.ts} +24 -27
  20. package/lib/project-files/src/models/User.ts +69 -70
  21. package/lib/project-files/src/models/common/{types.ts → IModel.ts} +4 -5
  22. package/lib/project-files/src/public/stylesheets/users.css +50 -48
  23. package/lib/project-files/src/repos/MockOrm.ts +57 -63
  24. package/lib/project-files/src/repos/UserRepo.ts +133 -133
  25. package/lib/project-files/src/repos/common/database.test.json +22 -0
  26. package/lib/project-files/src/routes/UserRoutes.ts +77 -69
  27. package/lib/project-files/src/routes/{index.ts → apiRouter.ts} +28 -31
  28. package/lib/project-files/src/routes/common/express-types.ts +9 -0
  29. package/lib/project-files/src/routes/common/{util/index.ts → parseReq.ts} +19 -16
  30. package/lib/project-files/src/server.ts +79 -86
  31. package/lib/project-files/src/services/UserService.ts +64 -70
  32. package/lib/project-files/src/views/users.html +118 -132
  33. package/lib/project-files/tests/common/{utils.ts → comparators.ts} +38 -55
  34. package/lib/project-files/tests/common/error-utils.ts +25 -0
  35. package/lib/project-files/tests/common/{types.ts → supertest-types.ts} +15 -16
  36. package/lib/project-files/tests/{aux/setup.ts → support/agent.ts} +23 -26
  37. package/lib/project-files/tests/users.test.ts +131 -123
  38. package/lib/project-files/tsconfig.json +30 -35
  39. package/lib/project-files/tsconfig.prod.json +27 -30
  40. package/lib/project-files/vitest.config.mts +18 -18
  41. package/package.json +1 -1
  42. package/lib/project-files/src/common/constants/HTTP_STATUS_CODES.ts +0 -81
  43. package/lib/project-files/src/common/constants/index.ts +0 -11
  44. package/lib/project-files/src/repos/database.test.json +0 -1
  45. package/lib/project-files/src/routes/common/types/index.ts +0 -10
  46. /package/lib/project-files/src/repos/{database.json → common/database.json} +0 -0
@@ -0,0 +1,25 @@
1
+ import { isString } from 'jet-validators';
2
+ import { ParseError, parseJson } from 'jet-validators/utils';
3
+
4
+ /******************************************************************************
5
+ Types
6
+ ******************************************************************************/
7
+
8
+ interface IValidationError {
9
+ message: string;
10
+ errors: ParseError[];
11
+ }
12
+
13
+ /******************************************************************************
14
+ Functions
15
+ ******************************************************************************/
16
+
17
+ /**
18
+ * JSON parse a validation error.
19
+ */
20
+ export function parseValidationError(arg: unknown): IValidationError {
21
+ if (!isString(arg)) {
22
+ throw new Error('Not a string');
23
+ }
24
+ return parseJson<IValidationError>(arg);
25
+ }
@@ -1,16 +1,15 @@
1
- import { Response } from 'supertest';
2
-
3
-
4
- /******************************************************************************
5
- Types
6
- ******************************************************************************/
7
-
8
- // Use generics to add properties to 'body'
9
- export type TRes<T = object> = Omit<Response, 'body'> & {
10
- body: T & { error?: string | IErrorObject },
11
- };
12
-
13
- interface IErrorObject {
14
- message: string;
15
- [key: string]: unknown;
16
- }
1
+ import { Response } from 'supertest';
2
+
3
+ /******************************************************************************
4
+ Types
5
+ ******************************************************************************/
6
+
7
+ // Use generics to add properties to 'body'
8
+ export interface IRes<T = object> extends Omit<Response, 'body'> {
9
+ body: T & { error?: string | IErrorObject };
10
+ }
11
+
12
+ interface IErrorObject {
13
+ message: string;
14
+ [key: string]: unknown;
15
+ }
@@ -1,26 +1,23 @@
1
-
2
- import { beforeAll } from 'vitest';
3
- import supertest, { Test } from 'supertest';
4
- import TestAgent from 'supertest/lib/agent';
5
-
6
- import app from '@src/server';
7
- import MockOrm from '@src/repos/MockOrm';
8
-
9
-
10
- /******************************************************************************
11
- Run
12
- ******************************************************************************/
13
-
14
- let agent: TestAgent<Test>;
15
-
16
- beforeAll(async () => {
17
- agent = supertest.agent(app);
18
- await MockOrm.cleanDb();
19
- });
20
-
21
-
22
- /******************************************************************************
23
- Export
24
- ******************************************************************************/
25
-
26
- export { agent };
1
+ import supertest, { Test } from 'supertest';
2
+ import TestAgent from 'supertest/lib/agent';
3
+ import { beforeAll } from 'vitest';
4
+
5
+ import MockOrm from '@src/repos/MockOrm';
6
+ import app from '@src/server';
7
+
8
+ /******************************************************************************
9
+ Run
10
+ ******************************************************************************/
11
+
12
+ let agent: TestAgent<Test>;
13
+
14
+ beforeAll(async () => {
15
+ agent = supertest.agent(app);
16
+ await MockOrm.cleanDb();
17
+ });
18
+
19
+ /******************************************************************************
20
+ Export
21
+ ******************************************************************************/
22
+
23
+ export { agent };
@@ -1,123 +1,131 @@
1
- import UserRepo from '@src/repos/UserRepo';
2
- import User, { IUser } from '@src/models/User';
3
- import { USER_NOT_FOUND_ERR } from '@src/services/UserService';
4
-
5
- import HTTP_STATUS_CODES from '@src/common/constants/HTTP_STATUS_CODES';
6
- import { ValidationError } from '@src/common/util/route-errors';
7
- import { JET_PATHS as Paths } from '@src/common/constants/PATHS';
8
-
9
- import { compareUserArrays, parseValidationError } from './common/utils';
10
- import { agent } from './aux/setup';
11
- import { TRes } from './common/types';
12
-
13
- /******************************************************************************
14
- Constants
15
- ******************************************************************************/
16
-
17
- const DUMMY_USERS = [
18
- User.new({ name: 'Sean Maxwell', email: 'sean.maxwell@gmail.com' }),
19
- User.new({ name: 'John Smith', email: 'john.smith@gmail.com' }),
20
- User.new({ name: 'Gordan Freeman', email: 'gordan.freeman@gmail.com' }),
21
- ] as const;
22
-
23
- const {
24
- BadRequest,
25
- Created,
26
- Ok: OK,
27
- NotFound,
28
- } = HTTP_STATUS_CODES;
29
-
30
- /******************************************************************************
31
- Tests
32
- IMPORTANT: Following TypeScript best practices, we test all scenarios that
33
- can be triggered by a user under normal circumstances. Not all theoretically
34
- scenarios (i.e. a failed database connection).
35
- ******************************************************************************/
36
-
37
- describe('UserRouter', () => {
38
-
39
- let dbUsers: IUser[] = [];
40
-
41
- beforeEach(async () => {
42
- await UserRepo.deleteAllUsers();
43
- dbUsers = await UserRepo.insertMultiple(DUMMY_USERS);
44
- });
45
-
46
- describe(`"GET:${Paths.Users.Get}"`, () => {
47
-
48
- it('should return a JSON object with all the users and a status code of ' +
49
- `"${OK}" if the request was successful.`, async () => {
50
- const res: TRes<{ users: IUser[]}> = await agent.get(Paths.Users.Get);
51
- expect(res.status).toBe(OK);
52
- expect(compareUserArrays(res.body.users, DUMMY_USERS)).toBeTruthy();
53
- });
54
- });
55
-
56
- describe(`"POST:${Paths.Users.Add}"`, () => {
57
-
58
- it(`should return a status code of "${Created}" if the request was ` +
59
- 'successful.', async () => {
60
- const user = User.new({ name: 'a', email: 'a@a.com' }),
61
- res = await agent.post(Paths.Users.Add).send({ user });
62
- expect(res.status).toBe(Created);
63
- });
64
-
65
- it('should return a JSON object with an error message of and a status ' +
66
- `code of "${BadRequest}" if the user param was missing.`, async () => {
67
- const res: TRes = await agent.post(Paths.Users.Add).send({ user: null });
68
- expect(res.status).toBe(BadRequest);
69
- const errorObject = parseValidationError(res.body.error);
70
- expect(errorObject.message).toBe(ValidationError.MESSAGE);
71
- expect(errorObject.errors[0].key).toStrictEqual('user');
72
- });
73
- });
74
-
75
- describe(`"PUT:${Paths.Users.Update}"`, () => {
76
-
77
- it(`should return a status code of "${OK}" if the request was successfull`,
78
- async () => {
79
- const user = DUMMY_USERS[0];
80
- user.name = 'Bill';
81
- const res = await agent.put(Paths.Users.Update).send({ user });
82
- expect(res.status).toBe(OK);
83
- });
84
-
85
- it('should return a JSON object with an error message and a status code ' +
86
- `of "${BadRequest}" if id is the wrong data type`, async () => {
87
- const user = User.new();
88
- user.id = ('5' as unknown as number);
89
- const res: TRes = await agent.put(Paths.Users.Update).send({ user });
90
- expect(res.status).toBe(BadRequest);
91
- const errorObj = parseValidationError(res.body.error);
92
- expect(errorObj.message).toBe(ValidationError.MESSAGE);
93
- expect(errorObj.errors[0].keyPath).toStrictEqual(['user', 'id']);
94
- });
95
-
96
- it('should return a JSON object with the error message of ' +
97
- `"${USER_NOT_FOUND_ERR}" and a status code of "${NotFound}" if the id ` +
98
- 'was not found.', async () => {
99
- const user = User.new({ id: 4, name: 'a', email: 'a@a.com' }),
100
- res: TRes = await agent.put(Paths.Users.Update).send({ user });
101
- expect(res.status).toBe(NotFound);
102
- expect(res.body.error).toBe(USER_NOT_FOUND_ERR);
103
- });
104
- });
105
-
106
- describe(`"DELETE:${Paths.Users.Delete()}"`, () => {
107
-
108
- it(`should return a status code of "${OK}" if the request was successful.`,
109
- async () => {
110
- const id = dbUsers[0].id,
111
- res = await agent.delete(Paths.Users.Delete(id));
112
- expect(res.status).toBe(OK);
113
- });
114
-
115
- it('should return a JSON object with the error message of ' +
116
- `"${USER_NOT_FOUND_ERR}" and a status code of "${NotFound}" if the id ` +
117
- 'was not found.', async () => {
118
- const res: TRes = await agent.delete(Paths.Users.Delete(-1));
119
- expect(res.status).toBe(NotFound);
120
- expect(res.body.error).toBe(USER_NOT_FOUND_ERR);
121
- });
122
- });
123
- });
1
+ import HttpStatusCodes from '@src/common/constants/HttpStatusCodes';
2
+ import { JetPaths as Paths } from '@src/common/constants/Paths';
3
+ import { ValidationError } from '@src/common/utils/route-errors';
4
+ import User, { IUser } from '@src/models/User';
5
+ import UserRepo from '@src/repos/UserRepo';
6
+
7
+ import { agent } from './support/agent';
8
+ import { IRes } from './common/supertest-types';
9
+ import { parseValidationError } from './common/error-utils';
10
+ import UserService from '@src/services/UserService';
11
+ import { compareUserArrays } from './common/comparators';
12
+
13
+ /******************************************************************************
14
+ Constants
15
+ ******************************************************************************/
16
+
17
+ const DUMMY_USERS = [
18
+ User.new({ name: 'Sean Maxwell', email: 'sean.maxwell@gmail.com' }),
19
+ User.new({ name: 'John Smith', email: 'john.smith@gmail.com' }),
20
+ User.new({ name: 'Gordan Freeman', email: 'gordan.freeman@gmail.com' }),
21
+ ] as const;
22
+
23
+ const { BAD_REQUEST, CREATED, OK, NOT_FOUND } = HttpStatusCodes;
24
+
25
+ /******************************************************************************
26
+ Tests
27
+ IMPORTANT: Following TypeScript best practices, we test all scenarios that
28
+ can be triggered by a user under normal circumstances. Not all theoretically
29
+ scenarios (i.e. a failed database connection).
30
+ ******************************************************************************/
31
+
32
+ describe('UserRouter', () => {
33
+ let dbUsers: IUser[] = [];
34
+
35
+ beforeEach(async () => {
36
+ await UserRepo.deleteAllUsers();
37
+ dbUsers = await UserRepo.insertMultiple(DUMMY_USERS);
38
+ });
39
+
40
+ describe(`"GET:${Paths.Users.Get}"`, () => {
41
+ it(
42
+ 'should return a JSON object with all the users and a status code of ' +
43
+ `"${OK}" if the request was successful.`,
44
+ async () => {
45
+ const res: IRes<{ users: IUser[] }> = await agent.get(Paths.Users.Get);
46
+ expect(res.status).toBe(OK);
47
+ expect(compareUserArrays(res.body.users, DUMMY_USERS)).toBeTruthy();
48
+ },
49
+ );
50
+ });
51
+
52
+ describe(`"POST:${Paths.Users.Add}"`, () => {
53
+ it(
54
+ `should return a status code of "${CREATED}" if the request was ` +
55
+ 'successful.',
56
+ async () => {
57
+ const user = User.new({ name: 'a', email: 'a@a.com' }),
58
+ res = await agent.post(Paths.Users.Add).send({ user });
59
+ expect(res.status).toBe(CREATED);
60
+ },
61
+ );
62
+
63
+ it(
64
+ 'should return a JSON object with an error message of and a status ' +
65
+ `code of "${BAD_REQUEST}" if the user param was missing.`,
66
+ async () => {
67
+ const res: IRes = await agent
68
+ .post(Paths.Users.Add)
69
+ .send({ user: null });
70
+ expect(res.status).toBe(BAD_REQUEST);
71
+ const errorObject = parseValidationError(res.body.error);
72
+ expect(errorObject.message).toBe(ValidationError.MESSAGE);
73
+ expect(errorObject.errors[0].key).toStrictEqual('user');
74
+ },
75
+ );
76
+ });
77
+
78
+ describe(`"PUT:${Paths.Users.Update}"`, () => {
79
+ it(`should return a status code of "${OK}" if the request was successfull`, async () => {
80
+ const user = DUMMY_USERS[0];
81
+ user.name = 'Bill';
82
+ const res = await agent.put(Paths.Users.Update).send({ user });
83
+ expect(res.status).toBe(OK);
84
+ });
85
+
86
+ it(
87
+ 'should return a JSON object with an error message and a status code ' +
88
+ `of "${BAD_REQUEST}" if id is the wrong data type`,
89
+ async () => {
90
+ const user = User.new();
91
+ user.id = '5' as unknown as number;
92
+ const res: IRes = await agent.put(Paths.Users.Update).send({ user });
93
+ expect(res.status).toBe(BAD_REQUEST);
94
+ const errorObj = parseValidationError(res.body.error);
95
+ expect(errorObj.message).toBe(ValidationError.MESSAGE);
96
+ expect(errorObj.errors[0].keyPath).toStrictEqual(['user', 'id']);
97
+ },
98
+ );
99
+
100
+ it(
101
+ 'should return a JSON object with the error message of ' +
102
+ `"${UserService.Errors.USER_NOT_FOUND}" and a status code of ` +
103
+ `"${NOT_FOUND}" if the id was not found.`,
104
+ async () => {
105
+ const user = User.new({ id: 4, name: 'a', email: 'a@a.com' }),
106
+ res: IRes = await agent.put(Paths.Users.Update).send({ user });
107
+ expect(res.status).toBe(NOT_FOUND);
108
+ expect(res.body.error).toBe(UserService.Errors.USER_NOT_FOUND);
109
+ },
110
+ );
111
+ });
112
+
113
+ describe(`"DELETE:${Paths.Users.Delete()}"`, () => {
114
+ it(`should return a status code of "${OK}" if the request was successful.`, async () => {
115
+ const id = dbUsers[0].id,
116
+ res = await agent.delete(Paths.Users.Delete(id));
117
+ expect(res.status).toBe(OK);
118
+ });
119
+
120
+ it(
121
+ 'should return a JSON object with the error message of ' +
122
+ `"${UserService.Errors.USER_NOT_FOUND}" and a status code of ` +
123
+ '"${NOT_FOUND}" if the id was not found.',
124
+ async () => {
125
+ const res: IRes = await agent.delete(Paths.Users.Delete(-1));
126
+ expect(res.status).toBe(NOT_FOUND);
127
+ expect(res.body.error).toBe(UserService.Errors.USER_NOT_FOUND);
128
+ },
129
+ );
130
+ });
131
+ });
@@ -1,35 +1,30 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "CommonJS",
5
- "lib": ["ES2020"],
6
- "strict": true,
7
- "baseUrl": "./",
8
- "esModuleInterop": true,
9
- "skipLibCheck": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "paths": {
12
- "@src/*": ["src/*"]
13
- },
14
- "useUnknownInCatchVariables": false,
15
- "types": ["vitest/globals"],
16
- },
17
- "ts-node": {
18
- "swc": true,
19
- "require": [
20
- "tsconfig-paths/register",
21
- "./config.ts"
22
- ],
23
- },
24
- "include": [
25
- "src/**/*.ts",
26
- "tests/**/*.ts",
27
- "config.ts",
28
- "scripts",
29
- "eslint.config.ts",
30
- "vitest.config.mts"
31
- ],
32
- "exclude": [
33
- "src/public/*"
34
- ]
35
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "commonjs",
5
+ "lib": ["ES2020"],
6
+ "strict": true,
7
+ "baseUrl": "./",
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "paths": {
12
+ "@src/*": ["src/*"]
13
+ },
14
+ "useUnknownInCatchVariables": false,
15
+ "types": ["vitest/globals"]
16
+ },
17
+ "ts-node": {
18
+ "swc": true,
19
+ "require": ["tsconfig-paths/register", "./config.ts"]
20
+ },
21
+ "include": [
22
+ "src/**/*.ts",
23
+ "tests/**/*.ts",
24
+ "config.ts",
25
+ "scripts",
26
+ "eslint.config.ts",
27
+ "vitest.config.mts"
28
+ ],
29
+ "exclude": ["src/public/*"]
30
+ }
@@ -1,30 +1,27 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "CommonJS",
5
- "lib": ["ES2020"],
6
- "strict": true,
7
- "baseUrl": "./",
8
- "outDir": "temp",
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "paths": {
13
- "@src/*": ["src/*"]
14
- },
15
- "useUnknownInCatchVariables": false,
16
- "sourceMap": false,
17
- "removeComments": true
18
- },
19
- "include": [
20
- "src/**/*.ts",
21
- "config.ts"
22
- ],
23
- "exclude": [
24
- "tests",
25
- "src/public/",
26
- "scripts",
27
- "eslint.config.ts",
28
- "vitest.config.js"
29
- ]
30
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "module": "CommonJS",
5
+ "lib": ["ES2020"],
6
+ "strict": true,
7
+ "baseUrl": "./",
8
+ "outDir": "temp",
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "paths": {
13
+ "@src/*": ["src/*"]
14
+ },
15
+ "useUnknownInCatchVariables": false,
16
+ "sourceMap": false,
17
+ "removeComments": true
18
+ },
19
+ "include": ["src/**/*.ts", "config.ts"],
20
+ "exclude": [
21
+ "tests",
22
+ "src/public/",
23
+ "scripts",
24
+ "eslint.config.ts",
25
+ "vitest.config.js"
26
+ ]
27
+ }
@@ -1,18 +1,18 @@
1
- import { defineConfig } from 'vitest/config';
2
- import path from 'path';
3
-
4
- const config = defineConfig({
5
- test: {
6
- globals: true,
7
- environment: 'node',
8
- setupFiles: ['config.ts', './tests/aux/setup.ts'],
9
- isolate: true,
10
- },
11
- resolve: {
12
- alias: {
13
- '@src': path.resolve(__dirname, './src'),
14
- },
15
- },
16
- });
17
-
18
- export default config;
1
+ import path from 'path';
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ const config = defineConfig({
5
+ test: {
6
+ globals: true,
7
+ environment: 'node',
8
+ setupFiles: ['config.ts', './tests/support/agent.ts'],
9
+ isolate: true,
10
+ },
11
+ resolve: {
12
+ alias: {
13
+ '@src': path.resolve(__dirname, './src'),
14
+ },
15
+ },
16
+ });
17
+
18
+ export default config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "2.7.10",
3
+ "version": "2.7.12",
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,81 +0,0 @@
1
- /* eslint-disable max-len */
2
-
3
- import { ValueOf } from 'jet-validators';
4
-
5
-
6
- /**
7
- * Hypertext Transfer Protocol (HTTP) response status codes.
8
- * @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
9
- *
10
- * This file was copied from here: https://gist.github.com/scokmen/f813c904ef79022e84ab2409574d1b45
11
- */
12
- const HTTP_STATUS_CODES = {
13
- Continue: 100,
14
- SwitchingProtocols: 101,
15
- Processing: 102,
16
- Ok: 200,
17
- Created: 201,
18
- Accepted: 202,
19
- NonAuthoritativeInformation: 203,
20
- NoContent: 204,
21
- ResetContent: 205,
22
- PartialContent: 206,
23
- MultiStatus: 207,
24
- AlreadyReported: 208,
25
- ImUsed: 226,
26
- MultipleChoices: 300,
27
- MovedPermanently: 301,
28
- Found: 302,
29
- SeeOther: 303,
30
- NotModified: 304,
31
- UseProxy: 305,
32
- SwitchProxy: 306,
33
- TemporaryRedirect: 307,
34
- PermanentRedirect: 308,
35
- BadRequest: 400,
36
- Unauthorized: 401,
37
- PaymentRequired: 402,
38
- Forbidden: 403,
39
- NotFound: 404,
40
- MethodNotAllowed: 405,
41
- NotAcceptable: 406,
42
- ProxyAuthenticationRequired: 407,
43
- RequestTimeout: 408,
44
- Conflict: 409,
45
- Gone: 410,
46
- LengthRequired: 411,
47
- PreconditionFailed: 412,
48
- PayloadTooLarge: 413,
49
- UriTooLong: 414,
50
- UnsupportedMediaType: 415,
51
- RangeNotSatisfiable: 416,
52
- ExpectationFailed: 417,
53
- IamaTeapot: 418,
54
- MisdirectedRequest: 421,
55
- UnprocessableEntity: 422,
56
- Locked: 423,
57
- FailedDependency: 424,
58
- UpgradeRequired: 426,
59
- PreconditionRequired: 428,
60
- TooManyRequests: 429,
61
- RequestHeaderFieldsTooLarge: 431,
62
- UnavailableForLegalReasons: 451,
63
- InternalServerError: 500,
64
- NotImplemented: 501,
65
- BadGateway: 502,
66
- ServiceUnavailable: 503,
67
- GatewayTimeout: 504,
68
- HttpVersionNotSupported: 505,
69
- VariantAlsoNegotiates: 506,
70
- InsuffientStorage: 507,
71
- LoopDetected: 508,
72
- NotExtended: 510,
73
- NetworkAuthenticationRequired: 511,
74
- } as const;
75
-
76
- /******************************************************************************
77
- Export default
78
- ******************************************************************************/
79
-
80
- export type HttpStatusCodes = ValueOf<typeof HTTP_STATUS_CODES>;
81
- export default HTTP_STATUS_CODES;
@@ -1,11 +0,0 @@
1
-
2
- /******************************************************************************
3
- Constants
4
- ******************************************************************************/
5
-
6
- // NOTE: These need to match the names of your ".env" files
7
- export const NODE_ENVS = {
8
- Dev: 'development',
9
- Test: 'test',
10
- Production: 'production',
11
- } as const;
@@ -1 +0,0 @@
1
- {"users":[{"id":169238117092,"name":"Bill","email":"sean.maxwell@gmail.com","created":"2026-01-01T23:26:38.953Z"},{"id":463030566103,"name":"John Smith","email":"john.smith@gmail.com","created":"2026-01-01T23:26:38.953Z"},{"id":420935775197,"name":"Gordan Freeman","email":"gordan.freeman@gmail.com","created":"2026-01-01T23:26:38.953Z"}]}
@@ -1,10 +0,0 @@
1
- import { Response, Request } from 'express';
2
-
3
- /******************************************************************************
4
- Types
5
- ******************************************************************************/
6
-
7
- type TRecord = Record<string, unknown>;
8
- export type IReq = Request<TRecord, void, TRecord, TRecord>;
9
- export type IRes = Response<unknown, TRecord>;
10
-