Improve response factories and add helper functions
This commit is contained in:
@@ -1,13 +1,18 @@
|
||||
import Controller from '../../../lib/src/http/Controller.ts'
|
||||
import {Request} from '../../../lib/src/http/Request.ts'
|
||||
import {error, html, redirect} from '../../../lib/src/http/response/helpers.ts'
|
||||
|
||||
export default class TestController extends Controller {
|
||||
|
||||
get_home(req: any) {
|
||||
req.response.body = 'Hello!'
|
||||
get_home(request: Request) {
|
||||
return html('<h1>Hi!</h1>')
|
||||
}
|
||||
get_user_home(req: any) {
|
||||
throw new Error('Hello, world!')
|
||||
}
|
||||
create_user_home(req: any) {}
|
||||
|
||||
get_user_home(request: Request) {
|
||||
return redirect('/home')
|
||||
}
|
||||
|
||||
create_user_home(request: Request) {
|
||||
return error('Not implemented!')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user