create-forkly 0.8.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-forkly",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "CLI to scaffold a new Forkly project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,12 +1,14 @@
1
1
  /** 首页路由 — GET / */
2
- import { Router } from 'forkly';
2
+ import { setRouter } from 'forkly';
3
3
 
4
- export class IndexRouter extends Router {
4
+ const Base = setRouter({});
5
+
6
+ export class IndexRouter extends Base {
5
7
 
6
8
  async get() {
7
9
  return {
8
10
  message: 'Welcome to Forkly!',
9
- version: '0.8.0',
11
+ version: '0.9.1',
10
12
  timestamp: Date.now(),
11
13
  };
12
14
  }
@@ -1,5 +1,5 @@
1
1
  /** 动态路由示例 — GET /users/:id */
2
- import { Router } from 'forkly';
2
+ import { setRouter } from 'forkly';
3
3
 
4
4
  // 模拟数据库
5
5
  const users: Record<string, { name: string; email: string }> = {
@@ -7,7 +7,9 @@ const users: Record<string, { name: string; email: string }> = {
7
7
  '2': { name: 'Bob', email: 'bob@example.com' },
8
8
  };
9
9
 
10
- export class UserRouter extends Router {
10
+ const Base = setRouter({});
11
+
12
+ export class UserRouter extends Base {
11
13
 
12
14
  async get() {
13
15
  const id = this.request.params.id;