@modern-js/server-generator 3.0.0-beta.2 → 3.0.0-beta.4

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 CHANGED
@@ -11,7 +11,7 @@
11
11
  "modern",
12
12
  "modern.js"
13
13
  ],
14
- "version": "3.0.0-beta.2",
14
+ "version": "3.0.0-beta.4",
15
15
  "jsnext:source": "./src/index.ts",
16
16
  "types": "./src/index.ts",
17
17
  "main": "./dist/index.js",
@@ -21,25 +21,19 @@
21
21
  ],
22
22
  "devDependencies": {
23
23
  "@babel/runtime": "^7.18.0",
24
- "@modern-js/codesmith": "2.0.1",
25
- "@modern-js/codesmith-api-app": "2.0.1",
26
- "@modern-js/codesmith-api-json": "2.0.1",
24
+ "@modern-js/codesmith": "2.0.2",
25
+ "@modern-js/codesmith-api-app": "2.0.2",
26
+ "@modern-js/codesmith-api-json": "2.0.2",
27
27
  "@types/jest": "^27",
28
28
  "@types/node": "^14",
29
29
  "jest": "^27",
30
30
  "typescript": "^4",
31
- "@modern-js/generator-common": "3.0.0-beta.2",
32
- "@modern-js/generator-utils": "3.0.0-beta.2",
33
- "@scripts/build": "2.0.0-beta.2",
34
- "@scripts/jest-config": "2.0.0-beta.2"
31
+ "@modern-js/generator-common": "3.0.0-beta.4",
32
+ "@modern-js/generator-utils": "3.0.0-beta.4",
33
+ "@scripts/build": "2.0.0-beta.4",
34
+ "@scripts/jest-config": "2.0.0-beta.4"
35
35
  },
36
36
  "sideEffects": false,
37
- "modernConfig": {
38
- "output": {
39
- "packageMode": "node-js",
40
- "disableSourceMap": true
41
- }
42
- },
43
37
  "publishConfig": {
44
38
  "registry": "https://registry.npmjs.org/",
45
39
  "access": "public"
@@ -0,0 +1,9 @@
1
+ export const middleware = async (context, next) => {
2
+ console.info(`user access url:${context.request.pathname}`);
3
+ next();
4
+ };
5
+
6
+ export const afterRender = (context, next) => {
7
+ context.template.appendBody('EdenX Server');
8
+ next();
9
+ };
@@ -0,0 +1,11 @@
1
+ import { Middleware, AfterRenderHook } from '@modern-js/runtime/server';
2
+
3
+ export const middleware: Middleware = async (context, next) => {
4
+ console.info(`user access url:${context.request.pathname}`);
5
+ next();
6
+ };
7
+
8
+ export const afterRender: AfterRenderHook = (context, next) => {
9
+ context.template.appendBody('EdenX Server');
10
+ next();
11
+ };
@@ -1,8 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
-
3
- export default hook(({ addMiddleware }) => {
4
- addMiddleware(async (req, res, next) => {
5
- console.info(`access url: ${req.url}`);
6
- next();
7
- });
8
- });
@@ -1,9 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
- import { Request, Response, NextFunction } from 'express';
3
-
4
- export default hook(({ addMiddleware }) => {
5
- addMiddleware(async (req: Request, res: Response, next: NextFunction) => {
6
- console.info(`access url: ${req.url}`);
7
- next();
8
- });
9
- });
@@ -1,8 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
-
3
- export default hook(({ addMiddleware }) => {
4
- addMiddleware(async (ctx, next) => {
5
- console.info(`access url: ${ctx.url}`);
6
- await next();
7
- });
8
- });
@@ -1,9 +0,0 @@
1
- import { hook } from '@modern-js/runtime/server';
2
- import { Context, Next } from 'koa';
3
-
4
- export default hook(({ addMiddleware }) => {
5
- addMiddleware(async (ctx: Context, next: Next) => {
6
- console.info(`access url: ${ctx.url}`);
7
- await next();
8
- });
9
- });