express-generator-typescript 2.0.0 → 2.0.1
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/README.md +1 -3
- package/lib/project-files/.eslintrc.json +1 -0
- package/lib/project-files/spec/support/login-agent.ts +6 -8
- package/lib/project-files/spec/tests/users.spec.ts +1 -1
- package/lib/project-files/spec/types/supertest/index.d.ts +2 -2
- package/lib/project-files/src/repos/mock-orm.ts +2 -2
- package/lib/project-files/src/repos/user-repo.ts +6 -6
- package/lib/project-files/src/routes/auth-router.ts +4 -3
- package/lib/project-files/src/util/jwt-util.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,6 @@ Creates a new express application similar to the _express-generator_ module. Exc
|
|
|
13
13
|
application is configured to use TypeScript instead of plain JavaScript.
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
## Why express-generator-typescript?
|
|
18
17
|
|
|
19
18
|
NodeJS is great for the rapid development of web-projects, but is often neglected because of the lack of
|
|
@@ -97,7 +96,7 @@ In previous version of __express-generator-typescript__ you could disregard auth
|
|
|
97
96
|
command line options. But maintaining two separate project folders which contained and didn't contain
|
|
98
97
|
authentication started to get messy.
|
|
99
98
|
|
|
100
|
-
- Remove following modules from `package.json`:
|
|
99
|
+
- Remove the following modules from `package.json`:
|
|
101
100
|
- `jsonwebtoken`
|
|
102
101
|
- `@types/jsonwebtoken`
|
|
103
102
|
- `bcrypt`
|
|
@@ -157,7 +156,6 @@ To be able to debug in VSCODE on windows I also had to install the `node-gyp` mo
|
|
|
157
156
|
Happy web deving :)
|
|
158
157
|
|
|
159
158
|
|
|
160
|
-
|
|
161
159
|
## License
|
|
162
160
|
|
|
163
161
|
[MIT](LICENSE)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import bcrypt from 'bcrypt';
|
|
2
|
-
import { SuperTest, Test } from 'supertest';
|
|
2
|
+
import { SuperTest, Test, Response } from 'supertest';
|
|
3
3
|
|
|
4
4
|
import User, { UserRoles } from '@models/user-model';
|
|
5
5
|
import userRepo from '@repos/user-repo';
|
|
@@ -19,9 +19,6 @@ const creds = {
|
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* Login a user.
|
|
22
|
-
*
|
|
23
|
-
* @param beforeAgent
|
|
24
|
-
* @param done
|
|
25
22
|
*/
|
|
26
23
|
function login(beforeAgent: SuperTest<Test>, done: (arg: string) => void) {
|
|
27
24
|
// Setup dummy data
|
|
@@ -34,17 +31,18 @@ function login(beforeAgent: SuperTest<Test>, done: (arg: string) => void) {
|
|
|
34
31
|
.post('/api/auth/login')
|
|
35
32
|
.type('form')
|
|
36
33
|
.send(creds)
|
|
37
|
-
.end((err: Error, res:
|
|
34
|
+
.end((err: Error, res: Response) => {
|
|
38
35
|
if (err) {
|
|
39
36
|
throw err;
|
|
40
37
|
}
|
|
41
|
-
|
|
38
|
+
const cookie = res.headers['set-cookie'][0];
|
|
39
|
+
return done(cookie);
|
|
42
40
|
});
|
|
43
|
-
}
|
|
41
|
+
}
|
|
44
42
|
|
|
45
43
|
|
|
46
44
|
// **** Export default **** //
|
|
47
45
|
|
|
48
46
|
export default {
|
|
49
|
-
|
|
47
|
+
login,
|
|
50
48
|
} as const;
|
|
@@ -79,10 +79,10 @@ async function _delete(id: number): Promise<void> {
|
|
|
79
79
|
// **** Export default **** //
|
|
80
80
|
|
|
81
81
|
export default {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
getOne,
|
|
83
|
+
persists,
|
|
84
|
+
getAll,
|
|
85
|
+
add,
|
|
86
|
+
update,
|
|
87
|
+
delete: _delete,
|
|
88
88
|
} as const;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "express-generator-typescript",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
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",
|