Skip to content

ecmadao/Learn-Koa2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn-Koa2

一个由Koa2和React搭建的ToDo-List App

Node菜鸟简单记录一下学习Koa2的过程,该项目为系列文章的源码

需要读者已经熟悉js以及ES6,了解npm和express

Play Online Demo

koa2-todolist

Menu

  1. middleware
  2. router
  3. controller & template
  4. context
  5. model & mongodb
  6. 认证
  7. work with frontend
  8. tools

Gitbook

Playground

本地玩起来

prepare

$ git clone git@github.com:ecmadao/Learn-Koa2.git
$ cd Learn-Koa2
$ npm install

config

  • 配置MongoDB

    • 启动127.0.0.1:27017连接,并创建koa2-todo数据库。否则就根据自己的实际情况修改config/default.json文件里的mongodb url

MongoDB入门与本地配置推荐:MongoDB 极简实践入门

  • 新建一个OAuth application

    • Application nameKoa2-Todo
    • Homepage URLhttp://localhost:7000
    • Authorization callback URLhttp://localhost:7000/user/login/github

Application name可以修改成其他值,但要和config/default.json中的githubConfig appName一致

Homepage URLAuthorization callback URL的7000端口可以自定义,不过要记得修改app/app.js里最后的启动端口

创建好以后,把获取的clientIdclientSecret分别填入config/default.json中的githubConfig clientIdgithubConfig clientSecret

关于Github OAuth application的更多内容,可以查阅:使用github作为第三方登录

$ npm run rock_dev
# then open localhost:7000

License

Apache License 2.0

About

A Koa2 Todo-List App, build with React & PostCSS & Webpack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published