Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@koa/router #63

Open
i5ting opened this issue Apr 16, 2020 · 2 comments
Open

@koa/router #63

i5ting opened this issue Apr 16, 2020 · 2 comments

Comments

@i5ting
Copy link
Owner

i5ting commented Apr 16, 2020

diff --git a/package.json b/package.json
index 16b6b46..556d519 100644
--- a/package.json
+++ b/package.json
@@ -9,19 +9,19 @@
     "test": "echo \"Error: no test specified\" && exit 1"
   },
   "dependencies": {
+    "@koa/router": "^9.0.0",
     "debug": "^4.1.1",
-    "koa": "^2.7.0",
-    "koa-bodyparser": "^4.2.1",
+    "koa": "^2.11.0",
+    "koa-bodyparser": "^4.3.0",
     "koa-convert": "^1.2.0",
     "koa-json": "^2.0.2",
-    "koa-logger": "^3.2.0",
+    "koa-logger": "^3.2.1",
     "koa-onerror": "^4.1.0",
-    "koa-router": "^7.4.0",
     "koa-static": "^5.0.0",
-    "koa-views": "^6.2.0",
-    "pug": "^2.0.3"
+    "koa-views": "^6.2.1",
+    "pug": "^2.0.4"
   },
   "devDependencies": {
-    "nodemon": "^1.19.1"
+    "nodemon": "^1.19.4"
   }
 }
diff --git a/routes/index.js b/routes/index.js
index f75048e..89b8678 100644
--- a/routes/index.js
+++ b/routes/index.js
@@ -1,4 +1,4 @@
-const router = require('koa-router')()
+const router = require('@koa/router')()

 router.get('/', async (ctx, next) => {
   await ctx.render('index', {
diff --git a/routes/users.js b/routes/users.js
index c650166..bf66675 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -1,4 +1,4 @@
-const router = require('koa-router')()
+const router = require('@koa/router')()

 router.prefix('/users')

koa-router已经更名为 @koa/router

@i5ting
Copy link
Owner Author

i5ting commented Apr 16, 2020

{
  "name": "hello-koa2",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "start": "node bin/www",
    "dev": "./node_modules/.bin/nodemon bin/www",
    "prd": "pm2 start bin/www",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "@koa/router": "^9.0.0",
    "debug": "^4.1.1",
    "koa": "^2.11.0",
    "koa-bodyparser": "^4.3.0",
    "koa-convert": "^1.2.0",
    "koa-json": "^2.0.2",
    "koa-logger": "^3.2.1",
    "koa-onerror": "^4.1.0",
    "koa-static": "^5.0.0",
    "koa-views": "^6.2.1",
    "pug": "^2.0.4"
  },
  "devDependencies": {
    "nodemon": "^1.19.4"
  }
}

@i5ting
Copy link
Owner Author

i5ting commented Apr 16, 2020

TODO

  • 默认koa是koa2
  • 保留koa1和koa2别名
  • 增加jest
  • 使用ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant