express-generator-typescript 2.4.10 → 2.4.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.
- package/lib/project-files/spec/support/Paths.ts +1 -1
- package/lib/project-files/spec/tests/users.spec.ts +1 -1
- package/lib/project-files/src/{other/classes.ts → common/RouteError.ts} +7 -6
- package/lib/project-files/src/index.ts +1 -1
- package/lib/project-files/src/routes/UserRoutes.ts +2 -2
- package/lib/project-files/src/routes/common/types.ts +33 -0
- package/lib/project-files/src/routes/{api.ts → index.ts} +1 -1
- package/lib/project-files/src/server.ts +7 -8
- package/lib/project-files/src/services/UserService.ts +3 -2
- package/lib/project-files-auth/spec/support/Paths.ts +1 -1
- package/lib/project-files-auth/spec/tests/auth.spec.ts +2 -2
- package/lib/project-files-auth/spec/tests/users.spec.ts +6 -6
- package/lib/project-files-auth/src/{other/classes.ts → common/RouteError.ts} +7 -6
- package/lib/project-files-auth/src/index.ts +1 -1
- package/lib/project-files-auth/src/routes/AuthRoutes.ts +2 -2
- package/lib/project-files-auth/src/routes/UserRoutes.ts +2 -2
- package/lib/project-files-auth/src/routes/common/types.ts +64 -0
- package/lib/project-files-auth/src/routes/{api.ts → index.ts} +4 -3
- package/lib/project-files-auth/src/routes/middleware/adminMw.ts +6 -10
- package/lib/project-files-auth/src/server.ts +6 -6
- package/lib/project-files-auth/src/services/AuthService.ts +3 -2
- package/lib/project-files-auth/src/services/UserService.ts +3 -4
- package/lib/project-files-auth/src/util/SessionUtil.ts +3 -4
- package/package.json +1 -1
- package/lib/project-files/src/routes/types/express/index.d.ts +0 -11
- package/lib/project-files/src/routes/types/express/misc.ts +0 -12
- package/lib/project-files/src/routes/types/types.ts +0 -14
- package/lib/project-files-auth/src/routes/types/express/index.d.ts +0 -11
- package/lib/project-files-auth/src/routes/types/express/misc.ts +0 -16
- package/lib/project-files-auth/src/routes/types/types.ts +0 -22
- /package/lib/project-files/src/{constants → common}/EnvVars.ts +0 -0
- /package/lib/project-files/src/{constants → common}/HttpStatusCodes.ts +0 -0
- /package/lib/project-files/src/{constants → common}/Paths.ts +0 -0
- /package/lib/project-files/src/{constants → common}/misc.ts +0 -0
- /package/lib/project-files-auth/src/{constants → common}/EnvVars.ts +0 -0
- /package/lib/project-files-auth/src/{constants → common}/HttpStatusCodes.ts +0 -0
- /package/lib/project-files-auth/src/{constants → common}/Paths.ts +0 -0
- /package/lib/project-files-auth/src/{constants → common}/misc.ts +0 -0
|
@@ -7,7 +7,7 @@ import app from '@src/server';
|
|
|
7
7
|
|
|
8
8
|
import UserRepo from '@src/repos/UserRepo';
|
|
9
9
|
import User, { IUser } from '@src/models/User';
|
|
10
|
-
import HttpStatusCodes from '@src/
|
|
10
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
11
11
|
import { USER_NOT_FOUND_ERR } from '@src/services/UserService';
|
|
12
12
|
|
|
13
13
|
import Paths from 'spec/support/Paths';
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* Miscellaneous shared classes go here.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import HttpStatusCodes from '@src/constants/HttpStatusCodes';
|
|
1
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
6
2
|
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* Error with status code and message
|
|
10
6
|
*/
|
|
11
|
-
|
|
7
|
+
class RouteError extends Error {
|
|
12
8
|
|
|
13
9
|
public status: HttpStatusCodes;
|
|
14
10
|
|
|
@@ -17,3 +13,8 @@ export class RouteError extends Error {
|
|
|
17
13
|
this.status = status;
|
|
18
14
|
}
|
|
19
15
|
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// **** Export default **** //
|
|
19
|
+
|
|
20
|
+
export default RouteError;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import HttpStatusCodes from '@src/
|
|
1
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
2
2
|
|
|
3
3
|
import UserService from '@src/services/UserService';
|
|
4
4
|
import { IUser } from '@src/models/User';
|
|
5
|
-
import { IReq, IRes } from './types
|
|
5
|
+
import { IReq, IRes } from './common/types';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// **** Functions **** //
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/**
|
|
3
|
+
* Shared types for routes.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Response, Request } from 'express';
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// **** Express Request **** //
|
|
10
|
+
|
|
11
|
+
type TPathParams = Record<string, string>;
|
|
12
|
+
|
|
13
|
+
interface QryObj {
|
|
14
|
+
[key: string]: string | string[] | undefined;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
type TQueryParams<U = void> =
|
|
18
|
+
U extends void
|
|
19
|
+
? QryObj
|
|
20
|
+
: U extends QryObj
|
|
21
|
+
? U
|
|
22
|
+
: never;
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export interface IReq<T = void, U extends QryObj | void = void> extends Request<TPathParams, void, T, TQueryParams<U>> {
|
|
26
|
+
body: T;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
export interface IRes extends Response {
|
|
31
|
+
locals: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
|
|
@@ -11,14 +11,13 @@ import logger from 'jet-logger';
|
|
|
11
11
|
|
|
12
12
|
import 'express-async-errors';
|
|
13
13
|
|
|
14
|
-
import BaseRouter from '@src/routes
|
|
15
|
-
import Paths from '@src/constants/Paths';
|
|
14
|
+
import BaseRouter from '@src/routes';
|
|
16
15
|
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
16
|
+
import Paths from '@src/common/Paths';
|
|
17
|
+
import EnvVars from '@src/common/EnvVars';
|
|
18
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
19
|
+
import RouteError from '@src/common/RouteError';
|
|
20
|
+
import { NodeEnvs } from '@src/common/misc';
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
// **** Variables **** //
|
|
@@ -65,7 +64,7 @@ app.use((
|
|
|
65
64
|
});
|
|
66
65
|
|
|
67
66
|
|
|
68
|
-
//
|
|
67
|
+
// **** Front-End Content **** //
|
|
69
68
|
|
|
70
69
|
// Set views directory (html)
|
|
71
70
|
const viewsDir = path.join(__dirname, 'views');
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import RouteError from '@src/common/RouteError';
|
|
2
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
3
|
+
|
|
1
4
|
import UserRepo from '@src/repos/UserRepo';
|
|
2
5
|
import { IUser } from '@src/models/User';
|
|
3
|
-
import { RouteError } from '@src/other/classes';
|
|
4
|
-
import HttpStatusCodes from '@src/constants/HttpStatusCodes';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
// **** Variables **** //
|
|
@@ -8,8 +8,8 @@ import PwdUtil from '@src/util/PwdUtil';
|
|
|
8
8
|
import User, { UserRoles } from '@src/models/User';
|
|
9
9
|
import { Errors } from '@src/services/AuthService';
|
|
10
10
|
|
|
11
|
-
import EnvVars from '@src/
|
|
12
|
-
import HttpStatusCodes from '@src/
|
|
11
|
+
import EnvVars from '@src/common/EnvVars';
|
|
12
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
13
13
|
|
|
14
14
|
import Paths from 'spec/support/Paths';
|
|
15
15
|
import apiCb from 'spec/support/apiCb';
|
|
@@ -7,7 +7,7 @@ import app from '@src/server';
|
|
|
7
7
|
|
|
8
8
|
import UserRepo from '@src/repos/UserRepo';
|
|
9
9
|
import User, { IUser } from '@src/models/User';
|
|
10
|
-
import HttpStatusCodes from '@src/
|
|
10
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
11
11
|
import { USER_NOT_FOUND_ERR } from '@src/services/UserService';
|
|
12
12
|
|
|
13
13
|
import Paths from 'spec/support/Paths';
|
|
@@ -51,7 +51,7 @@ describe('UserRouter', () => {
|
|
|
51
51
|
|
|
52
52
|
// Success
|
|
53
53
|
it('should return a JSON object with all the users and a status code ' +
|
|
54
|
-
`of "${HttpStatusCodes.OK}" if the request was successful.`,
|
|
54
|
+
`of "${HttpStatusCodes.OK}" if the request was successful.`, done => {
|
|
55
55
|
// Add spy
|
|
56
56
|
const data = getDummyUsers();
|
|
57
57
|
spyOn(UserRepo, 'getAll').and.resolveTo(data);
|
|
@@ -79,7 +79,7 @@ describe('UserRouter', () => {
|
|
|
79
79
|
|
|
80
80
|
// Test add user success
|
|
81
81
|
it(`should return a status code of "${HttpStatusCodes.CREATED}" if the ` +
|
|
82
|
-
'request was successful.',
|
|
82
|
+
'request was successful.', done => {
|
|
83
83
|
// Spy
|
|
84
84
|
spyOn(UserRepo, 'add').and.resolveTo();
|
|
85
85
|
// Call api
|
|
@@ -92,7 +92,7 @@ describe('UserRouter', () => {
|
|
|
92
92
|
// Missing param
|
|
93
93
|
it(`should return a JSON object with an error message of "${ERROR_MSG}" ` +
|
|
94
94
|
`and a status code of "${HttpStatusCodes.BAD_REQUEST}" if the user ` +
|
|
95
|
-
'param was missing.',
|
|
95
|
+
'param was missing.', done => {
|
|
96
96
|
// Call api
|
|
97
97
|
callApi(null, res => {
|
|
98
98
|
expect(res.status).toBe(HttpStatusCodes.BAD_REQUEST);
|
|
@@ -117,7 +117,7 @@ describe('UserRouter', () => {
|
|
|
117
117
|
|
|
118
118
|
// Success
|
|
119
119
|
it(`should return a status code of "${HttpStatusCodes.OK}" if the ` +
|
|
120
|
-
'request was successful.',
|
|
120
|
+
'request was successful.', done => {
|
|
121
121
|
// Setup spies
|
|
122
122
|
spyOn(UserRepo, 'update').and.resolveTo();
|
|
123
123
|
spyOn(UserRepo, 'persists').and.resolveTo(true);
|
|
@@ -131,7 +131,7 @@ describe('UserRouter', () => {
|
|
|
131
131
|
// Param missing
|
|
132
132
|
it(`should return a JSON object with an error message of "${ERROR_MSG}" ` +
|
|
133
133
|
`and a status code of "${HttpStatusCodes.BAD_REQUEST}" if the user ` +
|
|
134
|
-
'param was missing.',
|
|
134
|
+
'param was missing.', done => {
|
|
135
135
|
// Call api
|
|
136
136
|
callApi(null, res => {
|
|
137
137
|
expect(res.status).toBe(HttpStatusCodes.BAD_REQUEST);
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* Miscellaneous shared classes go here.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import HttpStatusCodes from '@src/constants/HttpStatusCodes';
|
|
1
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
6
2
|
|
|
7
3
|
|
|
8
4
|
/**
|
|
9
5
|
* Error with status code and message
|
|
10
6
|
*/
|
|
11
|
-
|
|
7
|
+
class RouteError extends Error {
|
|
12
8
|
|
|
13
9
|
public status: HttpStatusCodes;
|
|
14
10
|
|
|
@@ -17,3 +13,8 @@ export class RouteError extends Error {
|
|
|
17
13
|
this.status = status;
|
|
18
14
|
}
|
|
19
15
|
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// **** Export default **** //
|
|
19
|
+
|
|
20
|
+
export default RouteError;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import HttpStatusCodes from '@src/
|
|
1
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
2
2
|
import SessionUtil from '@src/util/SessionUtil';
|
|
3
3
|
import AuthService from '@src/services/AuthService';
|
|
4
4
|
|
|
5
|
-
import { IReq, IRes } from './types
|
|
5
|
+
import { IReq, IRes } from './common/types';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// **** Types **** //
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import HttpStatusCodes from '@src/
|
|
1
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
2
2
|
|
|
3
3
|
import UserService from '@src/services/UserService';
|
|
4
4
|
import { IUser } from '@src/models/User';
|
|
5
|
-
import { IReq, IRes } from './types
|
|
5
|
+
import { IReq, IRes } from './common/types';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
// **** Functions **** //
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// import * as e from 'express';
|
|
2
|
+
// import { Query } from 'express-serve-static-core';
|
|
3
|
+
|
|
4
|
+
// import { ISessionUser } from '@src/models/User';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// // **** Express **** //
|
|
8
|
+
|
|
9
|
+
// export interface IReq<T = void> extends e.Request {
|
|
10
|
+
// body: T;
|
|
11
|
+
// }
|
|
12
|
+
|
|
13
|
+
// export interface IReqQuery<T extends Query, U = void> extends e.Request {
|
|
14
|
+
// query: T;
|
|
15
|
+
// body: U;
|
|
16
|
+
// }
|
|
17
|
+
|
|
18
|
+
// export interface IRes extends e.Response {
|
|
19
|
+
// locals: {
|
|
20
|
+
// sessionUser: ISessionUser;
|
|
21
|
+
// };
|
|
22
|
+
// }
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
/* eslint-disable max-len */
|
|
26
|
+
/**
|
|
27
|
+
* Shared types for routes.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
import { Response, Request } from 'express';
|
|
31
|
+
import { ISessionUser } from '@src/models/User';
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
// **** Express Request **** //
|
|
35
|
+
|
|
36
|
+
type TPathParams = Record<string, string>;
|
|
37
|
+
|
|
38
|
+
interface QryObj {
|
|
39
|
+
[key: string]: string | string[] | undefined;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type TQueryParams<U = void> =
|
|
43
|
+
U extends void
|
|
44
|
+
? QryObj
|
|
45
|
+
: U extends QryObj
|
|
46
|
+
? U
|
|
47
|
+
: never;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
export interface IReq<T = void, U extends QryObj | void = void> extends Request<TPathParams, void, T, TQueryParams<U>> {
|
|
51
|
+
body: T;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
// **** Express Response **** //
|
|
56
|
+
|
|
57
|
+
interface ILocals {
|
|
58
|
+
sessionUser: ISessionUser;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// I know since its a type I should use 'TRes' instead of 'IRes' but I'm
|
|
62
|
+
// leaving it as this cause it looks better alongside 'IReq'
|
|
63
|
+
export type IRes = Response<unknown, ILocals>;
|
|
64
|
+
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import jetValidator from 'jet-validator';
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import Paths from '../constants/Paths';
|
|
4
|
+
import Paths from '@src/common/Paths';
|
|
6
5
|
import User from '@src/models/User';
|
|
6
|
+
|
|
7
|
+
import adminMw from './middleware/adminMw';
|
|
7
8
|
import AuthRoutes from './AuthRoutes';
|
|
8
9
|
import UserRoutes from './UserRoutes';
|
|
9
10
|
|
|
@@ -14,7 +15,7 @@ const apiRouter = Router(),
|
|
|
14
15
|
validate = jetValidator();
|
|
15
16
|
|
|
16
17
|
|
|
17
|
-
// ****
|
|
18
|
+
// **** Add AuthRouter **** //
|
|
18
19
|
|
|
19
20
|
const authRouter = Router();
|
|
20
21
|
|
|
@@ -2,33 +2,29 @@
|
|
|
2
2
|
* Middleware to verify user logged in and is an an admin.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { NextFunction } from 'express';
|
|
6
6
|
import { JwtPayload } from 'jsonwebtoken';
|
|
7
7
|
|
|
8
|
-
import HttpStatusCodes from '@src/
|
|
9
|
-
|
|
8
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
10
9
|
import SessionUtil from '@src/util/SessionUtil';
|
|
11
10
|
import { ISessionUser, UserRoles } from '@src/models/User';
|
|
12
11
|
|
|
12
|
+
import { IReq, IRes } from '../common/types';
|
|
13
|
+
|
|
13
14
|
|
|
14
15
|
// **** Variables **** //
|
|
15
16
|
|
|
16
17
|
const USER_UNAUTHORIZED_ERR = 'User not authorized to perform this action';
|
|
17
18
|
|
|
18
|
-
|
|
19
|
-
// **** Types **** //
|
|
20
|
-
|
|
21
19
|
type TSessionData = ISessionUser & JwtPayload;
|
|
22
20
|
|
|
23
21
|
|
|
24
|
-
// **** Functions **** //
|
|
25
|
-
|
|
26
22
|
/**
|
|
27
23
|
* See note at beginning of file.
|
|
28
24
|
*/
|
|
29
25
|
async function adminMw(
|
|
30
|
-
req:
|
|
31
|
-
res:
|
|
26
|
+
req: IReq,
|
|
27
|
+
res: IRes,
|
|
32
28
|
next: NextFunction,
|
|
33
29
|
) {
|
|
34
30
|
// Get session data
|
|
@@ -11,14 +11,14 @@ import logger from 'jet-logger';
|
|
|
11
11
|
|
|
12
12
|
import 'express-async-errors';
|
|
13
13
|
|
|
14
|
-
import BaseRouter from '@src/routes
|
|
15
|
-
import Paths from '@src/constants/Paths';
|
|
14
|
+
import BaseRouter from '@src/routes';
|
|
16
15
|
|
|
17
|
-
import
|
|
18
|
-
import
|
|
16
|
+
import Paths from '@src/common/Paths';
|
|
17
|
+
import EnvVars from '@src/common/EnvVars';
|
|
18
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
19
|
+
import { NodeEnvs } from '@src/common/misc';
|
|
19
20
|
|
|
20
|
-
import
|
|
21
|
-
import { RouteError } from '@src/other/classes';
|
|
21
|
+
import RouteError from '@src/common/RouteError';
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
// **** Variables **** //
|
|
@@ -3,8 +3,9 @@ import UserRepo from '@src/repos/UserRepo';
|
|
|
3
3
|
import PwdUtil from '@src/util/PwdUtil';
|
|
4
4
|
import { tick } from '@src/util/misc';
|
|
5
5
|
|
|
6
|
-
import HttpStatusCodes from '@src/
|
|
7
|
-
import
|
|
6
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
7
|
+
import RouteError from '@src/common/RouteError';
|
|
8
|
+
|
|
8
9
|
import { IUser } from '@src/models/User';
|
|
9
10
|
|
|
10
11
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import RouteError from '@src/common/RouteError';
|
|
2
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
3
|
+
|
|
1
4
|
import UserRepo from '@src/repos/UserRepo';
|
|
2
5
|
import { IUser } from '@src/models/User';
|
|
3
|
-
import { RouteError } from '@src/other/classes';
|
|
4
|
-
import HttpStatusCodes from '@src/constants/HttpStatusCodes';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
// **** Variables **** //
|
|
@@ -33,7 +34,6 @@ async function updateOne(user: IUser): Promise<void> {
|
|
|
33
34
|
if (!persists) {
|
|
34
35
|
throw new RouteError(HttpStatusCodes.NOT_FOUND, USER_NOT_FOUND_ERR);
|
|
35
36
|
}
|
|
36
|
-
// Return user
|
|
37
37
|
return UserRepo.update(user);
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -45,7 +45,6 @@ async function _delete(id: number): Promise<void> {
|
|
|
45
45
|
if (!persists) {
|
|
46
46
|
throw new RouteError(HttpStatusCodes.NOT_FOUND, USER_NOT_FOUND_ERR);
|
|
47
47
|
}
|
|
48
|
-
// Delete user
|
|
49
48
|
return UserRepo.delete(id);
|
|
50
49
|
}
|
|
51
50
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Request, Response } from 'express';
|
|
2
|
-
|
|
3
|
-
import HttpStatusCodes from '@src/constants/HttpStatusCodes';
|
|
4
|
-
import { RouteError } from '@src/other/classes';
|
|
5
2
|
import jsonwebtoken from 'jsonwebtoken';
|
|
6
3
|
|
|
7
|
-
import
|
|
4
|
+
import HttpStatusCodes from '@src/common/HttpStatusCodes';
|
|
5
|
+
import RouteError from '@src/common/RouteError';
|
|
6
|
+
import EnvVars from '@src/common/EnvVars';
|
|
8
7
|
|
|
9
8
|
|
|
10
9
|
// **** Variables **** //
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.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,14 +0,0 @@
|
|
|
1
|
-
import * as e from 'express';
|
|
2
|
-
import { Query } from 'express-serve-static-core';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// **** Express **** //
|
|
6
|
-
|
|
7
|
-
export interface IReq<T = void> extends e.Request {
|
|
8
|
-
body: T;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface IReqQuery<T extends Query, U = void> extends e.Request {
|
|
12
|
-
query: T;
|
|
13
|
-
body: U;
|
|
14
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as e from 'express';
|
|
2
|
-
|
|
3
|
-
import { ISessionUser } from '@src/models/User';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
// **** Express **** //
|
|
7
|
-
|
|
8
|
-
export interface IReq<T = void> extends e.Request {
|
|
9
|
-
body: T;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface IRes extends e.Response {
|
|
13
|
-
locals: {
|
|
14
|
-
sessionUser?: ISessionUser;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import * as e from 'express';
|
|
2
|
-
import { Query } from 'express-serve-static-core';
|
|
3
|
-
|
|
4
|
-
import { ISessionUser } from '@src/models/User';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// **** Express **** //
|
|
8
|
-
|
|
9
|
-
export interface IReq<T = void> extends e.Request {
|
|
10
|
-
body: T;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface IReqQuery<T extends Query, U = void> extends e.Request {
|
|
14
|
-
query: T;
|
|
15
|
-
body: U;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface IRes extends e.Response {
|
|
19
|
-
locals: {
|
|
20
|
-
sessionUser: ISessionUser;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|