1.1.27 • Published 5 years ago
@aotools/valka v1.1.27
工程目录结构
├── server.js
├── controllers
| └── User.js
├── templates
| └── index.html
Valka
import {Valka} from 'valka'
Valka({
baseDir: __dirname,
port: 3000,
enableAuth: true,
jwtSecret: "xxx",
})
Controller
import {Controller, Get, IContext, RequireLogin} from 'valka'
@Controller('/api/users')
export class User {
@Get('/', 'index.html')
async render() {
return { title: "title" }
}
@Get('/')
@RequireLogin()
async getUsers (ctx: IContext) {
const ctx.state.user
return { users: [user] }
}
}
使用
npm i valka --save
1.1.27
5 years ago
1.1.26
5 years ago
1.1.24
5 years ago
1.1.22
7 years ago
1.1.21
7 years ago
1.1.20
7 years ago
1.1.19
7 years ago
1.1.18
7 years ago
1.1.17
7 years ago
1.1.16
7 years ago
1.1.15
7 years ago
1.1.14
7 years ago
1.1.13
7 years ago
1.1.12
7 years ago
1.1.10
7 years ago
1.1.9
7 years ago
1.1.8
7 years ago
1.1.7
7 years ago
1.1.6
7 years ago
1.1.5
7 years ago
1.1.4
7 years ago
1.1.3
7 years ago
1.1.2
7 years ago
1.1.1
7 years ago
1.1.0
7 years ago