<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # [1.koa路由](https://github.com/alexmingoia/koa-router) >路由(Routing)是由一個URI(或叫路徑)和一個特定的HTTP方法(GET,POST)組成,涉及到應用如何響應客戶端對某個網頁節點的訪問。 - 路由就是根據不同的URL地址,加載不同的頁面實現不同功能。 ## 1.1安裝 ~~~ npm i koa-router --save ~~~ ## 1.2使用 簡單配置 ~~~ const Koa = require("koa"); const Router = require("koa-router"); //引入路由 const app = new Koa(); const router = new Router(); router.get('/',async (ctx,next)=>{ ctx.body = "router"; }) router.get('/new',async (ctx,next)=>{ ctx.body = "new" }) app.use(router.routes());//作用:啟動路由 app.use(router.allowedMethods()); app.listen(3000,()=>{ console.log("starting at port 3000"); }) ~~~ 簡化配置 ~~~ const Koa = require("koa"); const app = new Koa(); let router = require("koa-router")(); //配置路由 router.get("/",async (ctx,next)=>{ ctx.body="首頁" }).get('/news',async (ctx,next)=>{ ctx.body = "新聞" }) app.use(router.routes()).use(router.allowedMethods()); app.listen(3000) ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看