1.1.27 • Published 4 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
4 years ago
1.1.26
4 years ago
1.1.24
4 years ago
1.1.22
5 years ago
1.1.21
6 years ago
1.1.20
6 years ago
1.1.19
6 years ago
1.1.18
6 years ago
1.1.17
6 years ago
1.1.16
6 years ago
1.1.15
6 years ago
1.1.14
6 years ago
1.1.13
6 years ago
1.1.12
6 years ago
1.1.10
6 years ago
1.1.9
6 years ago
1.1.8
6 years ago
1.1.7
6 years ago
1.1.6
6 years ago
1.1.5
6 years ago
1.1.4
6 years ago
1.1.3
6 years ago
1.1.2
6 years ago
1.1.1
6 years ago
1.1.0
6 years ago