valka 1.0.6 • Public • Published 6 years ago 工程目录结构
├── server.js
├── controllers
| └── User.js
├── services
| └── User.js
└── models
└── User.js
Valka
import { Valka } from ' valka '
Valka ( {
baseDir : __dirname ,
port : 3000 ,
database : {
mongodb : {
url : ' mongodb://localhost:27017/db '
}
}
} )
Model
import { Model } from ' valka '
@Model
export default class User {
static schema = {
name : String
}
}
Service
import { Service , AutowiredModel } from ' valka '
@Service
export class User {
@ AutowiredModel ( ' User ' )
static UserModel
async getUsers ( ) {
return User . UserModel . find ( )
}
}
Controller
import { Controller , AutowiredService , Get } from ' valka '
@ Controller ( ' /api/users ' )
export class User {
@ AutowiredService ( ' User ' )
static UserService
@ Get ( ' / ' )
async getUsers ( ) {
return User . UserService . getUsers ( )
}
}
使用
npm i valka --save
TODO
valka-cli
support. Easily create and bootstrap a Valka project from command line.
Add BDD tests.
More documentaions.
Plugins design for client side project. One can easily integrate its Vue.js or React.js project with Valka project, and valka-cli
should have this kind of options?
...more
Readme Keywords none
Package Sidebar Install Downloads Weekly Downloads