Skip to content

chaohangz/koa-rest-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koa-rest-demo

REST demo with koa2

Installation

git clone https://github.com/chaohangz/koa-rest-demo.git

cd koa-rest-demo

npm install

说明

该项目有两个分支,master 分支比较简单,是一个完整的 mvc 的小架构。

从master分支演变到 routes 分支,省去了 router 的手动编写。我们添加了 handleRoutes 函数和统一了 controller 导出规则,项目一启动就查找整个 controller 目录,生成 router。这个方法来自廖雪峰老师的教程

routes 分支还添加了一个简单的 cookie 登录。

前后端分离的项目和前端开发在做本地调试的时候,会遇到跨域问题,routes 分支还添加了跨域处理。

Use

Node HTTP framework.

A full-featured koa body parser middleware.

Development style logger middleware for koa.

Router middleware for koa.

Static file server middleware.

Sequelize is a promise-based ORM for Node.js v4 and up. It supports the dialects PostgreSQL, MySQL, SQLite and MSSQL and features solid transaction support, relations, read replication and more.

Cross-Origin Resource Sharing(CORS) for koa

About

REST demo with koa2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published