至于未来会怎么样 反正路还长 天总会亮

Life is a journey, not a destination, care should be the scenery along the way and the mood to see the scenery.

个人博客
  • ...
     前端 浏览(24)  tangzihan ++阅读原文
    使用 koa-generator 搭建项目
    1.安装 `koa-generator` `cnpm i -g koa-generator` 2.使用命令创建项目 `koa2 project`:这种方式默认的模板引擎是pug `koa2 -e project `:项目使用ejs模板引擎 ![](http://) ![](http://www.zihanzy.com/uplo...
  • ...
     程序 浏览(39)  tangzihan ++阅读原文
    Koa搭建基本服务器
    目录结构 │ server.js │ ├─libs │ database.js │ ├─log ├─routers │ │ static.js │ │ │ ├─admin │ │ index.js │ │ │ ├─api │ └─www │ index.js │ ├─static...
  • ...
     程序 浏览(30)  tangzihan ++阅读原文
    Koa服务端渲染
    ![](http://) [pug渲染](https://www.pugjs.cn/api/getting-started.html) 1.基本使用 新键文件 template/1.pug 这个文件存放html模板 示例代码 doctype html head meta(charset="utf-8") title 测...
  • ...
     程序 浏览(27)  tangzihan ++阅读原文
    Koa
    下载 `cnpm i koa -D` 基本使用 javascript const Koa = require('koa'); let server = new Koa(); server.listen(8080); 路由 koa本身不带路由,因此我们要引入第三方模块 `cnpm i koa-router -D`...
  • ...
     程序 浏览(38)  tangzihan ++阅读原文
    Koa框架路由嵌套
    koa框架支持路由嵌套 可以实现类似php laravel框架路由分组功能 我们可以为某些模块构建一个路由对象,在这个路由对象上又继续构建其他子路由对象 如下两个路由 企业用户与普通用户看到的页面是不相同的 `.com/user/...