一个好用的 Koa2 模板

3,274 阅读1分钟

This boilerplate shows ways to

  • Use mysql in Koa2
  • CORS Ajax request
  • Ajax Login and Ajax Logout in Koa2, based on koa-passport and passport-local
  • Export excel in Koa2, based on excel-export
  • Serve static files in Koa2
  • Integrate with Redux App

Preview

Online Demo

Usage

$ npm install 
$ npm run start

Screenshots

Login Page

Structure

.
├── README.md
├── app
│   └── entry.js
├── package.json
├── src
│   ├── app.js
│   ├── config
│   │   ├── base.js
│   │   ├── config.js
│   │   └── passport.js
│   ├── lib
│   │   └── db.js
│   ├── middleware
│   │   ├── checkauth.js
│   │   └── index.js
│   ├── models
│   │   └── account.js
│   ├── public
│   │   └── index.html
│   └── routes
│       ├── auth.js
│       ├── index.js
│       ├── main.js
│       └── open.js
├── start.js
└── webpack.config.js