express-generator-typescript 2.7.10 → 2.7.11

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 (26) hide show
  1. package/lib/project-files/config/.env.development +3 -3
  2. package/lib/project-files/config/.env.production +3 -3
  3. package/lib/project-files/config/.env.test +3 -3
  4. package/lib/project-files/package.json +24 -24
  5. package/lib/project-files/src/common/constants/{ENV.ts → EnvVars.ts} +4 -4
  6. package/lib/project-files/src/common/constants/HttpStatusCodes.ts +394 -0
  7. package/lib/project-files/src/common/constants/{PATHS.ts → Paths.ts} +3 -3
  8. package/lib/project-files/src/common/constants/index.ts +4 -4
  9. package/lib/project-files/src/common/{util → utils}/route-errors.ts +2 -4
  10. package/lib/project-files/src/index.ts +3 -3
  11. package/lib/project-files/src/models/User.ts +23 -21
  12. package/lib/project-files/src/repos/MockOrm.ts +3 -3
  13. package/lib/project-files/src/repos/UserRepo.ts +1 -1
  14. package/lib/project-files/src/repos/database.test.json +1 -1
  15. package/lib/project-files/src/routes/UserRoutes.ts +10 -10
  16. package/lib/project-files/src/routes/common/{types/index.ts → types.ts} +3 -3
  17. package/lib/project-files/src/routes/common/{util/index.ts → utils.ts} +1 -1
  18. package/lib/project-files/src/routes/index.ts +7 -10
  19. package/lib/project-files/src/server.ts +9 -11
  20. package/lib/project-files/src/services/UserService/constants.ts +5 -0
  21. package/lib/project-files/src/services/{UserService.ts → UserService/index.ts} +7 -19
  22. package/lib/project-files/tests/users.test.ts +23 -23
  23. package/package.json +1 -1
  24. package/lib/project-files/src/common/constants/HTTP_STATUS_CODES.ts +0 -81
  25. /package/lib/project-files/src/common/{util → utils}/misc.ts +0 -0
  26. /package/lib/project-files/src/common/{util → utils}/validators.ts +0 -0
@@ -8,8 +8,8 @@ HOST=localhost
8
8
 
9
9
 
10
10
  ## Setup jet-logger ##
11
- JET_LOGGER_MODE=CONSOLE
11
+ JET_LOGGER_MODE=console
12
12
  JET_LOGGER_FILEPATH=jet-logger.log
13
- JET_LOGGER_TIMESTAMP=TRUE
14
- JET_LOGGER_FORMAT=LINE
13
+ JET_LOGGER_TIMESTAMP=true
14
+ JET_LOGGER_FORMAT=line
15
15
 
@@ -9,7 +9,7 @@ DISABLE_HELMET=TRUE
9
9
 
10
10
 
11
11
  ## Setup jet-logger ##
12
- JET_LOGGER_MODE=FILE
12
+ JET_LOGGER_MODE=file
13
13
  JET_LOGGER_FILEPATH=jet-logger.log
14
- JET_LOGGER_TIMESTAMP=TRUE
15
- JET_LOGGER_FORMAT=LINE
14
+ JET_LOGGER_TIMESTAMP=true
15
+ JET_LOGGER_FORMAT=line
@@ -8,7 +8,7 @@ HOST=localhost
8
8
 
9
9
 
10
10
  ## Setup jet-logger ##
11
- JET_LOGGER_MODE=CONSOLE
11
+ JET_LOGGER_MODE=console
12
12
  JET_LOGGER_FILEPATH=jet-logger.log
13
- JET_LOGGER_TIMESTAMP=TRUE
14
- JET_LOGGER_FORMAT=LINE
13
+ JET_LOGGER_TIMESTAMP=true
14
+ JET_LOGGER_FORMAT=line
@@ -14,43 +14,43 @@
14
14
  "engines": {
15
15
  "node": ">=16.0.0"
16
16
  },
17
- "dependencies": {
17
+ "dependencies": {
18
18
  "cookie-parser": "^1.4.7",
19
- "dayjs": "^1.11.13",
20
- "dotenv": "^16.5.0",
21
- "express": "^5.1.0",
19
+ "dayjs": "^1.11.19",
20
+ "dotenv": "^17.2.3",
21
+ "express": "^5.2.1",
22
22
  "helmet": "^8.1.0",
23
- "jet-env": "^1.1.4",
24
- "jet-logger": "^2.1.1",
23
+ "jet-env": "^1.1.6",
24
+ "jet-logger": "^2.2.3",
25
25
  "jet-paths": "^2.0.1",
26
- "jet-validators": "^2.0.9",
27
- "jsonfile": "^6.1.0",
26
+ "jet-validators": "^2.2.0",
27
+ "jsonfile": "^6.2.0",
28
28
  "module-alias": "^2.2.3",
29
- "morgan": "^1.10.0"
29
+ "morgan": "^1.10.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@eslint/js": "^9.25.1",
33
- "@stylistic/eslint-plugin": "^5.5.0",
34
- "@swc/core": "^1.11.22",
35
- "@types/cookie-parser": "^1.4.8",
32
+ "@eslint/js": "^9.39.2",
33
+ "@stylistic/eslint-plugin": "^5.7.0",
34
+ "@swc/core": "^1.15.8",
35
+ "@types/cookie-parser": "^1.4.10",
36
36
  "@types/find": "^0.2.4",
37
37
  "@types/fs-extra": "^11.0.4",
38
38
  "@types/jsonfile": "^6.1.4",
39
39
  "@types/module-alias": "^2.0.4",
40
- "@types/morgan": "^1.9.9",
41
- "@types/node": "^22.14.1",
40
+ "@types/morgan": "^1.9.10",
41
+ "@types/node": "^25.0.5",
42
42
  "@types/supertest": "^6.0.3",
43
- "eslint": "^9.25.1",
44
- "eslint-plugin-n": "^17.17.0",
43
+ "eslint": "^9.39.2",
44
+ "eslint-plugin-n": "^17.23.1",
45
45
  "find": "^0.3.0",
46
- "fs-extra": "^11.3.0",
47
- "jiti": "^2.4.2",
48
- "nodemon": "^3.1.10",
49
- "supertest": "^7.1.0",
46
+ "fs-extra": "^11.3.3",
47
+ "jiti": "^2.6.1",
48
+ "nodemon": "^3.1.11",
49
+ "supertest": "^7.2.2",
50
50
  "ts-node": "^10.9.2",
51
51
  "tsconfig-paths": "^4.2.0",
52
- "typescript": "^5.8.3",
53
- "typescript-eslint": "^8.32.0",
54
- "vitest": "^3.1.2"
52
+ "typescript": "^5.9.3",
53
+ "typescript-eslint": "^8.52.0",
54
+ "vitest": "^4.0.16"
55
55
  }
56
56
  }
@@ -1,14 +1,14 @@
1
1
  import jetEnv, { num } from 'jet-env';
2
2
  import { isValueOf } from 'jet-validators';
3
3
 
4
- import { NODE_ENVS } from '.';
4
+ import { NodeEnvs } from '.';
5
5
 
6
6
  /******************************************************************************
7
7
  Setup
8
8
  ******************************************************************************/
9
9
 
10
- const ENV = jetEnv({
11
- NodeEnv: isValueOf(NODE_ENVS),
10
+ const EnvVars = jetEnv({
11
+ NodeEnv: isValueOf(NodeEnvs),
12
12
  Port: num,
13
13
  });
14
14
 
@@ -16,4 +16,4 @@ const ENV = jetEnv({
16
16
  Export default
17
17
  ******************************************************************************/
18
18
 
19
- export default ENV;
19
+ export default EnvVars;
@@ -0,0 +1,394 @@
1
+ /* eslint-disable max-len */
2
+ import { ValueOf } from 'jet-validators';
3
+
4
+ /******************************************************************************
5
+ Constants
6
+ ******************************************************************************/
7
+
8
+ /**
9
+ * Hypertext Transfer Protocol (HTTP) response status codes.
10
+ *
11
+ * This file was copied from here:
12
+ * https://gist.github.com/scokmen/f813c904ef79022e84ab2409574d1b45
13
+ */
14
+ const HttpStatusCodes = {
15
+ /**
16
+ * The server has received the request headers and the client should proceed to send the request body
17
+ * (in the case of a request for which a body needs to be sent; for example, a POST request).
18
+ * Sending a large request body to a server after a request has been rejected for inappropriate headers would be inefficient.
19
+ * To have a server check the request's headers, a client must send Expect: 100-continue as a header in its initial request
20
+ * and receive a 100 Continue status code in response before sending the body. The response 417 Expectation Failed indicates the request should not be continued.
21
+ */
22
+ CONTINUE: 100,
23
+
24
+ /**
25
+ * The requester has asked the server to switch protocols and the server has agreed to do so.
26
+ */
27
+ SWITCHING_PROTOCOLS: 101,
28
+
29
+ /**
30
+ * A WebDAV request may contain many sub-requests involving file operations, requiring a long time to complete the request.
31
+ * This code indicates that the server has received and is processing the request, but no response is available yet.
32
+ * This prevents the client from timing out and assuming the request was lost.
33
+ */
34
+ PROCESSING: 102,
35
+
36
+ /**
37
+ * Standard response for successful HTTP requests.
38
+ * The actual response will depend on the request method used.
39
+ * In a GET request, the response will contain an entity corresponding to the requested resource.
40
+ * In a POST request, the response will contain an entity describing or containing the result of the action.
41
+ */
42
+ OK: 200,
43
+
44
+ /**
45
+ * The request has been fulfilled, resulting in the creation of a new resource.
46
+ */
47
+ CREATED: 201,
48
+
49
+ /**
50
+ * The request has been accepted for processing, but the processing has not been completed.
51
+ * The request might or might not be eventually acted upon, and may be disallowed when processing occurs.
52
+ */
53
+ ACCEPTED: 202,
54
+
55
+ /**
56
+ * SINCE HTTP/1.1
57
+ * The server is a transforming proxy that received a 200 OK from its origin,
58
+ * but is returning a modified version of the origin's response.
59
+ */
60
+ NON_AUTHORITATIVE_INFORMATION: 203,
61
+
62
+ /**
63
+ * The server successfully processed the request and is not returning any content.
64
+ */
65
+ NO_CONTENT: 204,
66
+
67
+ /**
68
+ * The server successfully processed the request, but is not returning any content.
69
+ * Unlike a 204 response, this response requires that the requester reset the document view.
70
+ */
71
+ RESET_CONTENT: 205,
72
+
73
+ /**
74
+ * The server is delivering only part of the resource (byte serving) due to a range header sent by the client.
75
+ * The range header is used by HTTP clients to enable resuming of interrupted downloads,
76
+ * or split a download into multiple simultaneous streams.
77
+ */
78
+ PARTIAL_CONTENT: 206,
79
+
80
+ /**
81
+ * The message body that follows is an XML message and can contain a number of separate response codes,
82
+ * depending on how many sub-requests were made.
83
+ */
84
+ MULTI_STATUS: 207,
85
+
86
+ /**
87
+ * The members of a DAV binding have already been enumerated in a preceding part of the (multistatus) response,
88
+ * and are not being included again.
89
+ */
90
+ ALREADY_REPORTED: 208,
91
+
92
+ /**
93
+ * The server has fulfilled a request for the resource,
94
+ * and the response is a representation of the result of one or more instance-manipulations applied to the current instance.
95
+ */
96
+ IM_USED: 226,
97
+
98
+ /**
99
+ * Indicates multiple options for the resource from which the client may choose (via agent-driven content negotiation).
100
+ * For example, this code could be used to present multiple video format options,
101
+ * to list files with different filename extensions, or to suggest word-sense disambiguation.
102
+ */
103
+ MULTIPLE_CHOICES: 300,
104
+
105
+ /**
106
+ * This and all future requests should be directed to the given URI.
107
+ */
108
+ MOVED_PERMANENTLY: 301,
109
+
110
+ /**
111
+ * This is an example of industry practice contradicting the standard.
112
+ * The HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect
113
+ * (the original describing phrase was "Moved Temporarily"), but popular browsers implemented 302
114
+ * with the functionality of a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307
115
+ * to distinguish between the two behaviours. However, some Web applications and frameworks
116
+ * use the 302 status code as if it were the 303.
117
+ */
118
+ FOUND: 302,
119
+
120
+ /**
121
+ * SINCE HTTP/1.1
122
+ * The response to the request can be found under another URI using a GET method.
123
+ * When received in response to a POST (or PUT/DELETE), the client should presume that
124
+ * the server has received the data and should issue a redirect with a separate GET message.
125
+ */
126
+ SEE_OTHER: 303,
127
+
128
+ /**
129
+ * Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match.
130
+ * In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy.
131
+ */
132
+ NOT_MODIFIED: 304,
133
+
134
+ /**
135
+ * SINCE HTTP/1.1
136
+ * The requested resource is available only through a proxy, the address for which is provided in the response.
137
+ * Many HTTP clients (such as Mozilla and Internet Explorer) do not correctly handle responses with this status code, primarily for security reasons.
138
+ */
139
+ USE_PROXY: 305,
140
+
141
+ /**
142
+ * No longer used. Originally meant "Subsequent requests should use the specified proxy."
143
+ */
144
+ SWITCH_PROXY: 306,
145
+
146
+ /**
147
+ * SINCE HTTP/1.1
148
+ * In this case, the request should be repeated with another URI; however, future requests should still use the original URI.
149
+ * In contrast to how 302 was historically implemented, the request method is not allowed to be changed when reissuing the original request.
150
+ * For example, a POST request should be repeated using another POST request.
151
+ */
152
+ TEMPORARY_REDIRECT: 307,
153
+
154
+ /**
155
+ * The request and all future requests should be repeated using another URI.
156
+ * 307 and 308 parallel the behaviors of 302 and 301, but do not allow the HTTP method to change.
157
+ * So, for example, submitting a form to a permanently redirected resource may continue smoothly.
158
+ */
159
+ PERMANENT_REDIRECT: 308,
160
+
161
+ /**
162
+ * The server cannot or will not process the request due to an apparent client error
163
+ * (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing).
164
+ */
165
+ BAD_REQUEST: 400,
166
+
167
+ /**
168
+ * Similar to 403 Forbidden, but specifically for use when authentication is required and has failed or has not yet
169
+ * been provided. The response must include a WWW-Authenticate header field containing a challenge applicable to the
170
+ * requested resource. See Basic access authentication and Digest access authentication. 401 semantically means
171
+ * "unauthenticated",i.e. the user does not have the necessary credentials.
172
+ */
173
+ UNAUTHORIZED: 401,
174
+
175
+ /**
176
+ * Reserved for future use. The original intention was that this code might be used as part of some form of digital
177
+ * cash or micro payment scheme, but that has not happened, and this code is not usually used.
178
+ * Google Developers API uses this status if a particular developer has exceeded the daily limit on requests.
179
+ */
180
+ PAYMENT_REQUIRED: 402,
181
+
182
+ /**
183
+ * The request was valid, but the server is refusing action.
184
+ * The user might not have the necessary permissions for a resource.
185
+ */
186
+ FORBIDDEN: 403,
187
+
188
+ /**
189
+ * The requested resource could not be found but may be available in the future.
190
+ * Subsequent requests by the client are permissible.
191
+ */
192
+ NOT_FOUND: 404,
193
+
194
+ /**
195
+ * A request method is not supported for the requested resource;
196
+ * for example, a GET request on a form that requires data to be presented via POST, or a PUT request on a read-only resource.
197
+ */
198
+ METHOD_NOT_ALLOWED: 405,
199
+
200
+ /**
201
+ * The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.
202
+ */
203
+ NOT_ACCEPTABLE: 406,
204
+
205
+ /**
206
+ * The client must first authenticate itself with the proxy.
207
+ */
208
+ PROXY_AUTHENTICATION_REQUIRED: 407,
209
+
210
+ /**
211
+ * The server timed out waiting for the request.
212
+ * According to HTTP specifications:
213
+ * "The client did not produce a request within the time that the server was prepared to wait. The client MAY repeat the request without modifications at any later time."
214
+ */
215
+ REQUEST_TIMEOUT: 408,
216
+
217
+ /**
218
+ * Indicates that the request could not be processed because of conflict in the request,
219
+ * such as an edit conflict between multiple simultaneous updates.
220
+ */
221
+ CONFLICT: 409,
222
+
223
+ /**
224
+ * Indicates that the resource requested is no longer available and will not be available again.
225
+ * This should be used when a resource has been intentionally removed and the resource should be purged.
226
+ * Upon receiving a 410 status code, the client should not request the resource in the future.
227
+ * Clients such as search engines should remove the resource from their indices.
228
+ * Most use cases do not require clients and search engines to purge the resource, and a "404 Not Found" may be used instead.
229
+ */
230
+ GONE: 410,
231
+
232
+ /**
233
+ * The request did not specify the length of its content, which is required by the requested resource.
234
+ */
235
+ LENGTH_REQUIRED: 411,
236
+
237
+ /**
238
+ * The server does not meet one of the preconditions that the requester put on the request.
239
+ */
240
+ PRECONDITION_FAILED: 412,
241
+
242
+ /**
243
+ * The request is larger than the server is willing or able to process. Previously called "Request Entity Too Large".
244
+ */
245
+ PAYLOAD_TOO_LARGE: 413,
246
+
247
+ /**
248
+ * The URI provided was too long for the server to process. Often the result of too much data being encoded as a query-string of a GET request,
249
+ * in which case it should be converted to a POST request.
250
+ * Called "Request-URI Too Long" previously.
251
+ */
252
+ URI_TOO_LONG: 414,
253
+
254
+ /**
255
+ * The request entity has a media type which the server or resource does not support.
256
+ * For example, the client uploads an image as image/svg+xml, but the server requires that images use a different format.
257
+ */
258
+ UNSUPPORTED_MEDIA_TYPE: 415,
259
+
260
+ /**
261
+ * The client has asked for a portion of the file (byte serving), but the server cannot supply that portion.
262
+ * For example, if the client asked for a part of the file that lies beyond the end of the file.
263
+ * Called "Requested Range Not Satisfiable" previously.
264
+ */
265
+ RANGE_NOT_SATISFIABLE: 416,
266
+
267
+ /**
268
+ * The server cannot meet the requirements of the Expect request-header field.
269
+ */
270
+ EXPECTATION_FAILED: 417,
271
+
272
+ /**
273
+ * This code was defined in 1998 as one of the traditional IETF April Fools' jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol,
274
+ * and is not expected to be implemented by actual HTTP servers. The RFC specifies this code should be returned by
275
+ * teapots requested to brew coffee. This HTTP status is used as an Easter egg in some websites, including Google.com.
276
+ */
277
+ I_AM_A_TEAPOT: 418,
278
+
279
+ /**
280
+ * The request was directed at a server that is not able to produce a response (for example because a connection reuse).
281
+ */
282
+ MISDIRECTED_REQUEST: 421,
283
+
284
+ /**
285
+ * The request was well-formed but was unable to be followed due to semantic errors.
286
+ */
287
+ UNPROCESSABLE_ENTITY: 422,
288
+
289
+ /**
290
+ * The resource that is being accessed is locked.
291
+ */
292
+ LOCKED: 423,
293
+
294
+ /**
295
+ * The request failed due to failure of a previous request (e.g., a PROPPATCH).
296
+ */
297
+ FAILED_DEPENDENCY: 424,
298
+
299
+ /**
300
+ * The client should switch to a different protocol such as TLS/1.0, given in the Upgrade header field.
301
+ */
302
+ UPGRADE_REQUIRED: 426,
303
+
304
+ /**
305
+ * The origin server requires the request to be conditional.
306
+ * Intended to prevent "the 'lost update' problem, where a client
307
+ * GETs a resource's state, modifies it, and PUTs it back to the server,
308
+ * when meanwhile a third party has modified the state on the server, leading to a conflict."
309
+ */
310
+ PRECONDITION_REQUIRED: 428,
311
+
312
+ /**
313
+ * The user has sent too many requests in a given amount of time. Intended for use with rate-limiting schemes.
314
+ */
315
+ TOO_MANY_REQUESTS: 429,
316
+
317
+ /**
318
+ * The server is unwilling to process the request because either an individual header field,
319
+ * or all the header fields collectively, are too large.
320
+ */
321
+ REQUEST_HEADER_FIELDS_TOO_LARGE: 431,
322
+
323
+ /**
324
+ * A server operator has received a legal demand to deny access to a resource or to a set of resources
325
+ * that includes the requested resource. The code 451 was chosen as a reference to the novel Fahrenheit 451.
326
+ */
327
+ UNAVAILABLE_FOR_LEGAL_REASONS: 451,
328
+
329
+ /**
330
+ * A generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
331
+ */
332
+ INTERNAL_SERVER_ERROR: 500,
333
+
334
+ /**
335
+ * The server either does not recognize the request method, or it lacks the ability to fulfill the request.
336
+ * Usually this implies future availability (e.g., a new feature of a web-service API).
337
+ */
338
+ NOT_IMPLEMENTED: 501,
339
+
340
+ /**
341
+ * The server was acting as a gateway or proxy and received an invalid response from the upstream server.
342
+ */
343
+ BAD_GATEWAY: 502,
344
+
345
+ /**
346
+ * The server is currently unavailable (because it is overloaded or down for maintenance).
347
+ * Generally, this is a temporary state.
348
+ */
349
+ SERVICE_UNAVAILABLE: 503,
350
+
351
+ /**
352
+ * The server was acting as a gateway or proxy and did not receive a timely response from the upstream server.
353
+ */
354
+ GATEWAY_TIMEOUT: 504,
355
+
356
+ /**
357
+ * The server does not support the HTTP protocol version used in the request
358
+ */
359
+ HTTP_VERSION_NOT_SUPPORTED: 505,
360
+
361
+ /**
362
+ * Transparent content negotiation for the request results in a circular reference.
363
+ */
364
+ VARIANT_ALSO_NEGOTIATES: 506,
365
+
366
+ /**
367
+ * The server is unable to store the representation needed to complete the request.
368
+ */
369
+ INSUFFICIENT_STORAGE: 507,
370
+
371
+ /**
372
+ * The server detected an infinite loop while processing the request.
373
+ */
374
+ LOOP_DETECTED: 508,
375
+
376
+ /**
377
+ * Further extensions to the request are required for the server to fulfill it.
378
+ */
379
+ NOT_EXTENDED: 510,
380
+
381
+ /**
382
+ * The client needs to authenticate to gain network access.
383
+ * Intended for use by intercepting proxies used to control access to the network (e.g., "captive portals" used
384
+ * to require agreement to Terms of Service before granting full Internet access via a Wi-Fi hotspot).
385
+ */
386
+ NETWORK_AUTHENTICATION_REQUIRED: 511,
387
+ } as const;
388
+
389
+ /******************************************************************************
390
+ Export default
391
+ ******************************************************************************/
392
+
393
+ type HttpStatusCodes = ValueOf<typeof HttpStatusCodes>;
394
+ export default HttpStatusCodes;
@@ -1,6 +1,6 @@
1
1
  import jetPaths from 'jet-paths';
2
2
 
3
- const PATHS = {
3
+ const Paths = {
4
4
  _: '/api',
5
5
  Users: {
6
6
  _: '/users',
@@ -11,5 +11,5 @@ const PATHS = {
11
11
  },
12
12
  } as const;
13
13
 
14
- export const JET_PATHS = jetPaths(PATHS);
15
- export default PATHS;
14
+ export const JetPaths = jetPaths(Paths);
15
+ export default Paths;
@@ -4,8 +4,8 @@
4
4
  ******************************************************************************/
5
5
 
6
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',
7
+ export const NodeEnvs = {
8
+ DEV: 'development',
9
+ TEST: 'test',
10
+ PRODUCTION: 'production',
11
11
  } as const;
@@ -1,8 +1,6 @@
1
1
  import { ParseError } from 'jet-validators/utils';
2
2
 
3
- import HTTP_STATUS_CODES, {
4
- HttpStatusCodes,
5
- } from '@src/common/constants/HTTP_STATUS_CODES';
3
+ import HttpStatusCodes from '@src/common/constants/HttpStatusCodes';
6
4
 
7
5
  /******************************************************************************
8
6
  Classes
@@ -33,6 +31,6 @@ export class ValidationError extends RouteError {
33
31
  message: ValidationError.MESSAGE,
34
32
  errors,
35
33
  });
36
- super(HTTP_STATUS_CODES.BadRequest, msg);
34
+ super(HttpStatusCodes.BAD_REQUEST, msg);
37
35
  }
38
36
  }
@@ -1,6 +1,6 @@
1
1
  import logger from 'jet-logger';
2
2
 
3
- import ENV from '@src/common/constants/ENV';
3
+ import EnvVars from '@src/common/constants/EnvVars';
4
4
  import server from './server';
5
5
 
6
6
 
@@ -9,7 +9,7 @@ import server from './server';
9
9
  ******************************************************************************/
10
10
 
11
11
  const SERVER_START_MSG = (
12
- 'Express server started on port: ' + ENV.Port.toString()
12
+ 'Express server started on port: ' + EnvVars.Port.toString()
13
13
  );
14
14
 
15
15
 
@@ -18,7 +18,7 @@ const SERVER_START_MSG = (
18
18
  ******************************************************************************/
19
19
 
20
20
  // Start the server
21
- server.listen(ENV.Port, err => {
21
+ server.listen(EnvVars.Port, err => {
22
22
  if (!!err) {
23
23
  logger.err(err.message);
24
24
  } else {
@@ -1,19 +1,23 @@
1
- import { isString, isUnsignedInteger } from 'jet-validators';
2
- import { parseObject, OnErrorCallback } from 'jet-validators/utils';
1
+ import { isNonEmptyString, isString, isUnsignedInteger } from 'jet-validators';
2
+ import {
3
+ parseObject,
4
+ Schema,
5
+ testObject,
6
+ } from 'jet-validators/utils';
3
7
 
4
- import { transformIsDate } from '@src/common/util/validators';
8
+ import { transformIsDate } from '@src/common/utils/validators';
5
9
  import { IModel } from './common/types';
6
10
 
7
11
  /******************************************************************************
8
12
  Constants
9
13
  ******************************************************************************/
10
14
 
11
- const DEFAULT_USER_VALS: IUser = {
15
+ const GetDefaults = (): IUser => ({
12
16
  id: 0,
13
17
  name: '',
14
- created: new Date(),
15
18
  email: '',
16
- } as const;
19
+ created: new Date(),
20
+ });
17
21
 
18
22
  /******************************************************************************
19
23
  Types
@@ -28,12 +32,21 @@ export interface IUser extends IModel {
28
32
  Setup
29
33
  ******************************************************************************/
30
34
 
31
- // Initialize the "parseUser" function
32
- const parseUser = parseObject<IUser>({
35
+ const schema: Schema<IUser> = {
33
36
  id: isUnsignedInteger,
34
37
  name: isString,
35
38
  email: isString,
36
39
  created: transformIsDate,
40
+ };
41
+
42
+ // Set the "parseUser" function
43
+ const parseUser = parseObject<IUser>(schema);
44
+
45
+ // For the APIs make sure the right fields are complete
46
+ const testIsCompleteUser = testObject<IUser>({
47
+ ...schema,
48
+ name: isNonEmptyString,
49
+ email: isNonEmptyString,
37
50
  });
38
51
 
39
52
  /******************************************************************************
@@ -44,27 +57,16 @@ const parseUser = parseObject<IUser>({
44
57
  * New user object.
45
58
  */
46
59
  function __new__(user?: Partial<IUser>): IUser {
47
- const defaults = { ...DEFAULT_USER_VALS };
48
- defaults.created = new Date();
49
- return parseUser({ ...defaults, ...user }, errors => {
60
+ return parseUser({ ...GetDefaults(), ...user }, errors => {
50
61
  throw new Error('Setup new user failed ' + JSON.stringify(errors, null, 2));
51
62
  });
52
63
  }
53
64
 
54
- /**
55
- * Check is a user object. For the route validation.
56
- */
57
-
58
- // because this isn't marked with the symbol, the errors are not bubbling up
59
- function test(arg: unknown, errCb?: OnErrorCallback): arg is IUser {
60
- return !!parseUser(arg, errCb);
61
- }
62
-
63
65
  /******************************************************************************
64
66
  Export default
65
67
  ******************************************************************************/
66
68
 
67
69
  export default {
68
70
  new: __new__,
69
- test,
71
+ isComplete: testIsCompleteUser,
70
72
  } as const;
@@ -1,7 +1,7 @@
1
1
  import jsonfile from 'jsonfile';
2
2
 
3
- import ENV from '@src/common/constants/ENV';
4
- import { NODE_ENVS } from '@src/common/constants';
3
+ import EnvVars from '@src/common/constants/EnvVars';
4
+ import { NodeEnvs } from '@src/common/constants';
5
5
  import { IUser } from '@src/models/User';
6
6
 
7
7
 
@@ -10,7 +10,7 @@ import { IUser } from '@src/models/User';
10
10
  ******************************************************************************/
11
11
 
12
12
  const DB_FILE_NAME = (
13
- ENV.NodeEnv === NODE_ENVS.Test
13
+ EnvVars.NodeEnv === NodeEnvs.TEST
14
14
  ? 'database.test.json'
15
15
  : 'database.json'
16
16
  );
@@ -1,5 +1,5 @@
1
1
  import { IUser } from '@src/models/User';
2
- import { getRandomInt } from '@src/common/util/misc';
2
+ import { getRandomInt } from '@src/common/utils/misc';
3
3
 
4
4
  import orm from './MockOrm';
5
5
 
@@ -1 +1 @@
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
+ {"users":[{"id":547317739445,"name":"Bill","email":"sean.maxwell@gmail.com","created":"2026-01-10T04:06:20.291Z"},{"id":332906029656,"name":"John Smith","email":"john.smith@gmail.com","created":"2026-01-10T04:06:20.291Z"},{"id":421195709596,"name":"Gordan Freeman","email":"gordan.freeman@gmail.com","created":"2026-01-10T04:06:20.291Z"}]}
@@ -1,20 +1,20 @@
1
1
  import { isNumber } from 'jet-validators';
2
2
  import { transform } from 'jet-validators/utils';
3
3
 
4
- import HTTP_STATUS_CODES from '@src/common/constants/HTTP_STATUS_CODES';
4
+ import HttpStatusCodes from '@src/common/constants/HttpStatusCodes';
5
5
  import UserService from '@src/services/UserService';
6
6
  import User from '@src/models/User';
7
7
 
8
8
  import { IReq, IRes } from './common/types';
9
- import { parseReq } from './common/util';
9
+ import { parseReq } from './common/utils';
10
10
 
11
11
  /******************************************************************************
12
12
  Constants
13
13
  ******************************************************************************/
14
14
 
15
15
  const Validators = {
16
- add: parseReq({ user: User.test }),
17
- update: parseReq({ user: User.test }),
16
+ add: parseReq({ user: User.isComplete }),
17
+ update: parseReq({ user: User.isComplete }),
18
18
  delete: parseReq({ id: transform(Number, isNumber) }),
19
19
  } as const;
20
20
 
@@ -27,7 +27,7 @@ const Validators = {
27
27
  */
28
28
  async function getAll(_: IReq, res: IRes) {
29
29
  const users = await UserService.getAll();
30
- res.status(HTTP_STATUS_CODES.Ok).json({ users });
30
+ res.status(HttpStatusCodes.OK).json({ users });
31
31
  }
32
32
 
33
33
  /**
@@ -36,7 +36,7 @@ async function getAll(_: IReq, res: IRes) {
36
36
  async function add(req: IReq, res: IRes) {
37
37
  const { user } = Validators.add(req.body);
38
38
  await UserService.addOne(user);
39
- res.status(HTTP_STATUS_CODES.Created).end();
39
+ res.status(HttpStatusCodes.CREATED).end();
40
40
  }
41
41
 
42
42
  /**
@@ -45,16 +45,16 @@ async function add(req: IReq, res: IRes) {
45
45
  async function update(req: IReq, res: IRes) {
46
46
  const { user } = Validators.update(req.body);
47
47
  await UserService.updateOne(user);
48
- res.status(HTTP_STATUS_CODES.Ok).end();
48
+ res.status(HttpStatusCodes.OK).end();
49
49
  }
50
50
 
51
51
  /**
52
52
  * Delete one user.
53
53
  */
54
- async function delete_(req: IReq, res: IRes) {
54
+ async function __delete__(req: IReq, res: IRes) {
55
55
  const { id } = Validators.delete(req.params);
56
56
  await UserService.delete(id);
57
- res.status(HTTP_STATUS_CODES.Ok).end();
57
+ res.status(HttpStatusCodes.OK).end();
58
58
  }
59
59
 
60
60
  /******************************************************************************
@@ -65,5 +65,5 @@ export default {
65
65
  getAll,
66
66
  add,
67
67
  update,
68
- delete: delete_,
68
+ delete: __delete__,
69
69
  } as const;
@@ -1,10 +1,10 @@
1
1
  import { Response, Request } from 'express';
2
+ import { PlainObject } from 'jet-validators';
2
3
 
3
4
  /******************************************************************************
4
5
  Types
5
6
  ******************************************************************************/
6
7
 
7
- type TRecord = Record<string, unknown>;
8
- export type IReq = Request<TRecord, void, TRecord, TRecord>;
9
- export type IRes = Response<unknown, TRecord>;
8
+ export type IReq = Request<PlainObject, void, PlainObject, PlainObject>;
9
+ export type IRes = Response<unknown, PlainObject>;
10
10
 
@@ -1,5 +1,5 @@
1
1
  import { parseObject, Schema } from 'jet-validators/utils';
2
- import { ValidationError } from '@src/common/util/route-errors';
2
+ import { ValidationError } from '@src/common/utils/route-errors';
3
3
 
4
4
  /******************************************************************************
5
5
  Functions
@@ -1,6 +1,6 @@
1
1
  import { Router } from 'express';
2
2
 
3
- import PATHS from '@src/common/constants/PATHS';
3
+ import Paths from '@src/common/constants/Paths';
4
4
  import UserRoutes from './UserRoutes';
5
5
 
6
6
  /******************************************************************************
@@ -10,19 +10,16 @@ import UserRoutes from './UserRoutes';
10
10
  const apiRouter = Router();
11
11
 
12
12
 
13
- // ** Add UserRouter ** //
13
+ // **** Add UserRouter **** //
14
14
 
15
- // Init router
16
15
  const userRouter = Router();
17
16
 
18
- // Get all users
19
- userRouter.get(PATHS.Users.Get, UserRoutes.getAll);
20
- userRouter.post(PATHS.Users.Add, UserRoutes.add);
21
- userRouter.put(PATHS.Users.Update, UserRoutes.update);
22
- userRouter.delete(PATHS.Users.Delete, UserRoutes.delete);
17
+ userRouter.get(Paths.Users.Get, UserRoutes.getAll);
18
+ userRouter.post(Paths.Users.Add, UserRoutes.add);
19
+ userRouter.put(Paths.Users.Update, UserRoutes.update);
20
+ userRouter.delete(Paths.Users.Delete, UserRoutes.delete);
23
21
 
24
- // Add UserRouter
25
- apiRouter.use(PATHS.Users._, userRouter);
22
+ apiRouter.use(Paths.Users._, userRouter);
26
23
 
27
24
  /******************************************************************************
28
25
  Export default
@@ -6,13 +6,11 @@ import logger from 'jet-logger';
6
6
 
7
7
  import BaseRouter from '@src/routes';
8
8
 
9
- import Paths from '@src/common/constants/PATHS';
10
- import ENV from '@src/common/constants/ENV';
11
- import HTTP_STATUS_CODES, {
12
- HttpStatusCodes,
13
- } from '@src/common/constants/HTTP_STATUS_CODES';
14
- import { RouteError } from '@src/common/util/route-errors';
15
- import { NODE_ENVS } from '@src/common/constants';
9
+ import Paths from '@src/common/constants/Paths';
10
+ import EnvVars from '@src/common/constants/EnvVars';
11
+ import HttpStatusCodes from '@src/common/constants/HttpStatusCodes';
12
+ import { RouteError } from '@src/common/utils/route-errors';
13
+ import { NodeEnvs } from '@src/common/constants';
16
14
 
17
15
 
18
16
  /******************************************************************************
@@ -29,12 +27,12 @@ app.use(express.json());
29
27
  app.use(express.urlencoded({extended: true}));
30
28
 
31
29
  // Show routes called in console during development
32
- if (ENV.NodeEnv === NODE_ENVS.Dev) {
30
+ if (EnvVars.NodeEnv === NodeEnvs.DEV) {
33
31
  app.use(morgan('dev'));
34
32
  }
35
33
 
36
34
  // Security
37
- if (ENV.NodeEnv === NODE_ENVS.Production) {
35
+ if (EnvVars.NodeEnv === NodeEnvs.PRODUCTION) {
38
36
  // eslint-disable-next-line n/no-process-env
39
37
  if (!process.env.DISABLE_HELMET) {
40
38
  app.use(helmet());
@@ -46,10 +44,10 @@ app.use(Paths._, BaseRouter);
46
44
 
47
45
  // Add error handler
48
46
  app.use((err: Error, _: Request, res: Response, next: NextFunction) => {
49
- if (ENV.NodeEnv !== NODE_ENVS.Test.valueOf()) {
47
+ if (EnvVars.NodeEnv !== NodeEnvs.TEST.valueOf()) {
50
48
  logger.err(err, true);
51
49
  }
52
- let status: HttpStatusCodes = HTTP_STATUS_CODES.BadRequest;
50
+ let status: HttpStatusCodes = HttpStatusCodes.BAD_REQUEST;
53
51
  if (err instanceof RouteError) {
54
52
  status = err.status;
55
53
  res.status(status).json({ error: err.message });
@@ -0,0 +1,5 @@
1
+ /******************************************************************************
2
+ Constants
3
+ ******************************************************************************/
4
+
5
+ export const USER_NOT_FOUND_ERROR = 'User not found';
@@ -1,14 +1,9 @@
1
- import { RouteError } from '@src/common/util/route-errors';
2
- import HTTP_STATUS_CODES from '@src/common/constants/HTTP_STATUS_CODES';
1
+ import { RouteError } from '@src/common/utils/route-errors';
2
+ import HttpStatusCodes from '@src/common/constants/HttpStatusCodes';
3
3
 
4
4
  import UserRepo from '@src/repos/UserRepo';
5
5
  import { IUser } from '@src/models/User';
6
-
7
- /******************************************************************************
8
- Constants
9
- ******************************************************************************/
10
-
11
- export const USER_NOT_FOUND_ERR = 'User not found';
6
+ import { USER_NOT_FOUND_ERROR } from './constants';
12
7
 
13
8
  /******************************************************************************
14
9
  Functions
@@ -34,10 +29,7 @@ function addOne(user: IUser): Promise<void> {
34
29
  async function updateOne(user: IUser): Promise<void> {
35
30
  const persists = await UserRepo.persists(user.id);
36
31
  if (!persists) {
37
- throw new RouteError(
38
- HTTP_STATUS_CODES.NotFound,
39
- USER_NOT_FOUND_ERR,
40
- );
32
+ throw new RouteError(HttpStatusCodes.NOT_FOUND, USER_NOT_FOUND_ERROR);
41
33
  }
42
34
  // Return user
43
35
  return UserRepo.update(user);
@@ -46,15 +38,11 @@ async function updateOne(user: IUser): Promise<void> {
46
38
  /**
47
39
  * Delete a user by their id.
48
40
  */
49
- async function _delete(id: number): Promise<void> {
41
+ async function __delete__(id: number): Promise<void> {
50
42
  const persists = await UserRepo.persists(id);
51
43
  if (!persists) {
52
- throw new RouteError(
53
- HTTP_STATUS_CODES.NotFound,
54
- USER_NOT_FOUND_ERR,
55
- );
44
+ throw new RouteError(HttpStatusCodes.NOT_FOUND, USER_NOT_FOUND_ERROR);
56
45
  }
57
- // Delete user
58
46
  return UserRepo.delete(id);
59
47
  }
60
48
 
@@ -66,5 +54,5 @@ export default {
66
54
  getAll,
67
55
  addOne,
68
56
  updateOne,
69
- delete: _delete,
57
+ delete: __delete__,
70
58
  } as const;
@@ -1,10 +1,10 @@
1
1
  import UserRepo from '@src/repos/UserRepo';
2
2
  import User, { IUser } from '@src/models/User';
3
- import { USER_NOT_FOUND_ERR } from '@src/services/UserService';
3
+ import { USER_NOT_FOUND_ERROR } from '@src/services/UserService/constants';
4
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';
5
+ import HttpStatusCodes from '@src/common/constants/HttpStatusCodes';
6
+ import { ValidationError } from '@src/common/utils/route-errors';
7
+ import { JetPaths as Paths } from '@src/common/constants/Paths';
8
8
 
9
9
  import { compareUserArrays, parseValidationError } from './common/utils';
10
10
  import { agent } from './aux/setup';
@@ -21,11 +21,11 @@ const DUMMY_USERS = [
21
21
  ] as const;
22
22
 
23
23
  const {
24
- BadRequest,
25
- Created,
26
- Ok: OK,
27
- NotFound,
28
- } = HTTP_STATUS_CODES;
24
+ BAD_REQUEST,
25
+ CREATED,
26
+ OK,
27
+ NOT_FOUND,
28
+ } = HttpStatusCodes;
29
29
 
30
30
  /******************************************************************************
31
31
  Tests
@@ -55,17 +55,17 @@ describe('UserRouter', () => {
55
55
 
56
56
  describe(`"POST:${Paths.Users.Add}"`, () => {
57
57
 
58
- it(`should return a status code of "${Created}" if the request was ` +
58
+ it(`should return a status code of "${CREATED}" if the request was ` +
59
59
  'successful.', async () => {
60
60
  const user = User.new({ name: 'a', email: 'a@a.com' }),
61
61
  res = await agent.post(Paths.Users.Add).send({ user });
62
- expect(res.status).toBe(Created);
62
+ expect(res.status).toBe(CREATED);
63
63
  });
64
64
 
65
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 () => {
66
+ `code of "${BAD_REQUEST}" if the user param was missing.`, async () => {
67
67
  const res: TRes = await agent.post(Paths.Users.Add).send({ user: null });
68
- expect(res.status).toBe(BadRequest);
68
+ expect(res.status).toBe(BAD_REQUEST);
69
69
  const errorObject = parseValidationError(res.body.error);
70
70
  expect(errorObject.message).toBe(ValidationError.MESSAGE);
71
71
  expect(errorObject.errors[0].key).toStrictEqual('user');
@@ -83,23 +83,23 @@ describe('UserRouter', () => {
83
83
  });
84
84
 
85
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 () => {
86
+ `of "${BAD_REQUEST}" if id is the wrong data type`, async () => {
87
87
  const user = User.new();
88
88
  user.id = ('5' as unknown as number);
89
89
  const res: TRes = await agent.put(Paths.Users.Update).send({ user });
90
- expect(res.status).toBe(BadRequest);
90
+ expect(res.status).toBe(BAD_REQUEST);
91
91
  const errorObj = parseValidationError(res.body.error);
92
92
  expect(errorObj.message).toBe(ValidationError.MESSAGE);
93
93
  expect(errorObj.errors[0].keyPath).toStrictEqual(['user', 'id']);
94
94
  });
95
95
 
96
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 () => {
97
+ `"${USER_NOT_FOUND_ERROR}" and a status code of "${NOT_FOUND}" if the ` +
98
+ 'id was not found.', async () => {
99
99
  const user = User.new({ id: 4, name: 'a', email: 'a@a.com' }),
100
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);
101
+ expect(res.status).toBe(NOT_FOUND);
102
+ expect(res.body.error).toBe(USER_NOT_FOUND_ERROR);
103
103
  });
104
104
  });
105
105
 
@@ -113,11 +113,11 @@ describe('UserRouter', () => {
113
113
  });
114
114
 
115
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 () => {
116
+ `"${USER_NOT_FOUND_ERROR}" and a status code of "${NOT_FOUND}" if the ` +
117
+ 'id was not found.', async () => {
118
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);
119
+ expect(res.status).toBe(NOT_FOUND);
120
+ expect(res.body.error).toBe(USER_NOT_FOUND_ERROR);
121
121
  });
122
122
  });
123
123
  });
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.11",
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;