materia-server
materia-server copied to clipboard
Controllers should store information contained in api.json
When an application begin to have lots of endpoints, api.json can be long and hard to read.
As #31, endpoints would be probably easier to read/write if api.json + controllers were merged
Something like the following example could work if as #31 we are able to edit / read the information contained in the class
@Controller('user')
class UserController {
constructor(private app: App) {}
@Get('/user/:email')
getUser = {
entity: 'user',
query: 'getByEmail'
}
@Post({
endpoint: '/user/signin',
params: [{
name: 'email',
type: DataType.TEXT,
required: true
},{
name: 'password',
type: DataType.TEXT,
required: true
}]
})
signin(req, res) {
//todo
res.status(200).send('ok')
}
}
- Materia Version: v1.0.0-beta.1