Fortune.js
Fortune.js 介绍
Fortune.js是一个超媒体 API 原型框架,实现 jsON API 规范。fortune 具有一个模块化的持久层,里面包括了 NeDB (内联),MongoDB,MysqL,Postgres 和 sqlite 的适配器。
Fortune 实现了所有 jsON API 的规范,还有一些其他的特性:
使用简单, Fortune 提供免费的路线控制和数据库交互,不需要用户制作管道。
在编辑前或者阅览之后,自动变换资源,实现特定的应用逻辑。
安装
npm install fortune --save
使用
const fortune = require('fortune') // Works in web browsers,too.
const store = fortune({
user: {
name: String,
// Following and followers are inversely related (many-to-many).
following: [ Array('user'),'followers' ],
followers: [ Array('user'),'following' ],
// Many-to-one relationship of user posts to post author.
posts: [ Array('post'),'author' ]
},
post: {
message: String,
// One-to-many relationship of post author to user posts.
author: [ 'user','posts' ]
}
})
GitHub:https://github.com/fortunejs/fortune
网站描述:一个超媒体 API 原型框架