Skip to content

Create you first CRUD API

Olaf Erlandsen edited this page Jul 19, 2018 · 2 revisions

Using TWF-CLI

You can use the command line interface to create a new API Controller

twf add controller index index.html

And yep, this is you API controller!

@Api
export class IndexController extends Controller {

    @HttpPost("/index.html")
    public create () {
        this.httpCreated();
    }

    @HttpGet("/index.html")
    public read () {
        this.httpOk();
    }

    @HttpPut("/index.html")
    public update () {
        this.httpOk();
    }

    @HttpDelete("/index.html")
    public delete () {
        this.httpOk();
    }
}
Clone this wiki locally