express-generator-typescript 1.8.7 → 1.9.0

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 CHANGED
@@ -88,7 +88,7 @@ $ cd "project name" && npm run start:dev
88
88
 
89
89
  ## Available commands for the server.
90
90
 
91
- - Run the server in development mode: `npm run start:dev`.
91
+ - Run the server in development mode: `npm run dev`.
92
92
  - Run all unit-tests with hot-reloading: `npm test`.
93
93
  - Run a single unit-test: `npm test -- --testFile="name of test file" (i.e. --testFile=Users)`.
94
94
  - Run all unit-tests without hot-reloading: `npm run test:no-reloading`
@@ -5,7 +5,7 @@
5
5
  "build": "npx ts-node build.ts",
6
6
  "lint": "eslint . --ext .ts",
7
7
  "start": "node -r module-alias/register ./dist --env=production",
8
- "start:dev": "nodemon",
8
+ "dev": "nodemon",
9
9
  "test": "nodemon --config ./spec/nodemon.json",
10
10
  "test:no-reloading": "npx ts-node --files -r tsconfig-paths/register ./spec"
11
11
  },
@@ -1,18 +1,28 @@
1
+ // ***** Start **** //
2
+
3
+ displayUsers();
4
+
5
+
1
6
  // ***** Fetch and display users **** //
2
7
 
3
- // Fetch all users
4
- Http.get('/api/users/all')
5
- .then(resp => resp.json())
6
- .then((resp) => {
7
- var allUsers = resp.users;
8
- // Empty the anchor
9
- var allUsersAnchor = document.getElementById('all-users-anchor');
10
- allUsersAnchor.innerHTML = '';
11
- // Append users to anchor
12
- allUsers.forEach((user) => {
13
- allUsersAnchor.innerHTML += getUserDisplayEle(user);
8
+ /**
9
+ * Call api
10
+ */
11
+ function displayUsers() {
12
+ Http
13
+ .get('/api/users/all')
14
+ .then(resp => resp.json())
15
+ .then((resp) => {
16
+ var allUsers = resp.users;
17
+ // Empty the anchor
18
+ var allUsersAnchor = document.getElementById('all-users-anchor');
19
+ allUsersAnchor.innerHTML = '';
20
+ // Append users to anchor
21
+ allUsers.forEach((user) => {
22
+ allUsersAnchor.innerHTML += getUserDisplayEle(user);
23
+ });
14
24
  });
15
- });
25
+ }
16
26
 
17
27
  /**
18
28
  * Get user display element
@@ -20,7 +20,7 @@ export const p = {
20
20
  } as const;
21
21
 
22
22
 
23
- // **** Functions **** //
23
+ // **** Routes **** //
24
24
 
25
25
  /**
26
26
  * Get all users.
@@ -5,7 +5,7 @@
5
5
  "build": "npx ts-node build.ts",
6
6
  "lint": "eslint . --ext .ts",
7
7
  "start": "node -r module-alias/register ./dist --env=production",
8
- "start:dev": "nodemon",
8
+ "dev": "nodemon",
9
9
  "test": "nodemon --config ./spec/nodemon.json",
10
10
  "test:no-reloading": "npx ts-node -r tsconfig-paths/register ./spec"
11
11
  },
@@ -1,18 +1,28 @@
1
+ // ***** Start **** //
2
+
3
+ displayUsers();
4
+
5
+
1
6
  // **** Fetch and display users **** //
2
7
 
3
- // Call api
4
- httpGet('/api/users/all')
5
- .then(response => response.json())
6
- .then((response) => {
7
- var allUsers = response.users;
8
- // Empty the anchor
9
- var allUsersAnchor = document.getElementById('all-users-anchor');
10
- allUsersAnchor.innerHTML = '';
11
- // Append users to anchor
12
- allUsers.forEach((user) => {
13
- allUsersAnchor.innerHTML += getUserDisplayEle(user);
8
+ /**
9
+ * Call api
10
+ */
11
+ function displayUsers() {
12
+ Http
13
+ .get('/api/users/all')
14
+ .then(resp => resp.json())
15
+ .then((resp) => {
16
+ var allUsers = resp.users;
17
+ // Empty the anchor
18
+ var allUsersAnchor = document.getElementById('all-users-anchor');
19
+ allUsersAnchor.innerHTML = '';
20
+ // Append users to anchor
21
+ allUsers.forEach((user) => {
22
+ allUsersAnchor.innerHTML += getUserDisplayEle(user);
23
+ });
14
24
  });
15
- });
25
+ }
16
26
 
17
27
  /**
18
28
  * Get the user display element
@@ -20,7 +20,7 @@ export const p = {
20
20
  } as const;
21
21
 
22
22
 
23
- // **** Functions **** //
23
+ // **** Routes **** //
24
24
 
25
25
  /**
26
26
  * Get all users
@@ -5,7 +5,7 @@
5
5
  "build": "npx ts-node build.ts",
6
6
  "lint": "eslint . --ext .ts",
7
7
  "start": "node -r module-alias/register ./dist --env=production",
8
- "start:dev": "nodemon",
8
+ "dev": "nodemon",
9
9
  "test": "nodemon --config ./spec/nodemon.json",
10
10
  "test:no-reloading": "npx ts-node --files -r tsconfig-paths/register ./spec"
11
11
  },
@@ -1,18 +1,28 @@
1
+ // ***** Start **** //
2
+
3
+ displayUsers();
4
+
5
+
1
6
  // **** Fetch and display users **** //
2
7
 
3
- // Call api
4
- Http.get('/api/users/all')
5
- .then(resp => resp.json())
6
- .then((resp) => {
7
- var allUsers = resp.users;
8
- // Empty the anchor
9
- var allUsersAnchor = document.getElementById('all-users-anchor');
10
- allUsersAnchor.innerHTML = '';
11
- // Append users to anchor
12
- allUsers.forEach((user) => {
13
- allUsersAnchor.innerHTML += getUserDisplayEle(user);
8
+ /**
9
+ * Call api
10
+ */
11
+ function displayUsers() {
12
+ Http
13
+ .get('/api/users/all')
14
+ .then(resp => resp.json())
15
+ .then((resp) => {
16
+ var allUsers = resp.users;
17
+ // Empty the anchor
18
+ var allUsersAnchor = document.getElementById('all-users-anchor');
19
+ allUsersAnchor.innerHTML = '';
20
+ // Append users to anchor
21
+ allUsers.forEach((user) => {
22
+ allUsersAnchor.innerHTML += getUserDisplayEle(user);
23
+ });
14
24
  });
15
- });
25
+ }
16
26
 
17
27
  /**
18
28
  * Get user display element.
@@ -124,9 +134,7 @@ function submitEdit(ele) {
124
134
  };
125
135
  Http
126
136
  .put('/api/users/update', data)
127
- .then(() => {
128
- displayUsers();
129
- });
137
+ .then(() => displayUsers());
130
138
  }
131
139
 
132
140
  /**
@@ -32,7 +32,7 @@ export const cookieProps = Object.freeze({
32
32
  });
33
33
 
34
34
 
35
- // **** Functions **** //
35
+ // **** Routes **** //
36
36
 
37
37
  /**
38
38
  * Login a user.
@@ -19,7 +19,7 @@ export const p = {
19
19
  } as const;
20
20
 
21
21
 
22
- // **** Functions **** //
22
+ // **** Routes **** //
23
23
 
24
24
  /**
25
25
  * Connect to socket room.
@@ -20,7 +20,7 @@ export const p = {
20
20
  } as const;
21
21
 
22
22
 
23
- // **** Functions **** //
23
+ // **** Routes **** //
24
24
 
25
25
  /**
26
26
  * Get all users.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "express-generator-typescript",
3
- "version": "1.8.7",
3
+ "version": "1.9.0",
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",