create-aomex 0.0.68 → 0.0.69
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/package.json +1 -1
- package/templates/.env +1 -1
- package/templates/Dockerfile.integration +1 -2
- package/templates/Dockerfile.production +1 -2
- package/templates/docker-compose.yml +1 -3
- package/templates/src/routers/{hello.router.ts → index.router.ts} +3 -6
- package/templates/src/web.ts +2 -1
- package/templates/tsconfig.json +2 -3
package/package.json
CHANGED
package/templates/.env
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
DATABASE_URL=mysql://
|
|
1
|
+
DATABASE_URL=mysql://root:abcde@localhost:3306/{{projectName}}
|
|
@@ -7,9 +7,8 @@ RUN mv .env.integration .env
|
|
|
7
7
|
ENV TZ=Asia/Shanghai
|
|
8
8
|
ENV PORT=3000
|
|
9
9
|
ENV NODE_ENV=integration
|
|
10
|
-
ENV NODE_OPTIONS='--enable-source-maps --stack-trace-limit=50'
|
|
11
10
|
ENV PATH="$PATH:/codes/node_modules/.bin"
|
|
12
11
|
|
|
13
12
|
RUN sh scripts/build-in-docker.sh
|
|
14
13
|
|
|
15
|
-
CMD ["node", "src/web.js"]
|
|
14
|
+
CMD ["node", "--enable-source-maps", "--stack-trace-limit=50", "src/web.js"]
|
|
@@ -7,9 +7,8 @@ RUN mv .env.production .env
|
|
|
7
7
|
ENV TZ=Asia/Shanghai
|
|
8
8
|
ENV PORT=3000
|
|
9
9
|
ENV NODE_ENV=production
|
|
10
|
-
ENV NODE_OPTIONS='--enable-source-maps --stack-trace-limit=50'
|
|
11
10
|
ENV PATH="$PATH:/codes/node_modules/.bin"
|
|
12
11
|
|
|
13
12
|
RUN sh scripts/build-in-docker.sh
|
|
14
13
|
|
|
15
|
-
CMD ["node", "src/web.js"]
|
|
14
|
+
CMD ["node", "--enable-source-maps", "--stack-trace-limit=50", "src/web.js"]
|
|
@@ -5,8 +5,6 @@ services:
|
|
|
5
5
|
MYSQL_ROOT_PASSWORD: 'abcde'
|
|
6
6
|
# 修改后需要同步修改.env里的参数
|
|
7
7
|
MYSQL_DATABASE: '{{projectName}}'
|
|
8
|
-
MYSQL_USER: 'my_user'
|
|
9
|
-
MYSQL_PASSWORD: 'my_pwd'
|
|
10
8
|
volumes:
|
|
11
9
|
- ./volumes/mysql:/var/lib/mysql
|
|
12
10
|
ports:
|
|
@@ -19,7 +17,7 @@ services:
|
|
|
19
17
|
timeout: 3s
|
|
20
18
|
retries: 10
|
|
21
19
|
redis:
|
|
22
|
-
image: redis:8.0
|
|
20
|
+
image: redis:8.0
|
|
23
21
|
volumes:
|
|
24
22
|
- ./volumes/redis:/data
|
|
25
23
|
ports:
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import { rule } from '@aomex/common';
|
|
2
|
-
import {
|
|
2
|
+
import { response, Router } from '@aomex/web';
|
|
3
3
|
|
|
4
4
|
export const router = new Router();
|
|
5
5
|
|
|
6
6
|
router.get('/', {
|
|
7
|
+
docs: { showInOpenapi: false },
|
|
7
8
|
mount: [
|
|
8
|
-
query({
|
|
9
|
-
user: rule.string().optional(),
|
|
10
|
-
}),
|
|
11
9
|
response({
|
|
12
10
|
statusCode: 200,
|
|
13
11
|
content: rule.string(),
|
|
14
12
|
}),
|
|
15
13
|
],
|
|
16
14
|
action: (ctx) => {
|
|
17
|
-
|
|
18
|
-
ctx.send(`Hello ${user}`);
|
|
15
|
+
ctx.send('Hello World');
|
|
19
16
|
},
|
|
20
17
|
});
|
package/templates/src/web.ts
CHANGED
|
@@ -52,7 +52,8 @@ if (cluster.isPrimary) {
|
|
|
52
52
|
logger.info(`Worker ${worker.id} is listening ${href}`);
|
|
53
53
|
})
|
|
54
54
|
.on('exit', (worker, code, signal) => {
|
|
55
|
-
|
|
55
|
+
const msg = `Worker ${worker.id} exit with code '${code}' and signal '${signal}'`;
|
|
56
|
+
logger.error(msg);
|
|
56
57
|
cluster.fork();
|
|
57
58
|
});
|
|
58
59
|
}
|