Skip to content

“Regular” Restful routes #34

Answered by eandre
dangdennis asked this question in Help
Discussion options

You must be logged in to vote

Update September 2021: Encore now ships with first-class REST API support 🎉! Check out the docs to get started :)

Hey @dangdennis, you can certainly do HTML templating from your API routes by dropping down to a "raw handler":

package myservice

//encore:api public raw
func MyHandler(w http.ResponseWriter, req *http.Request) {
    tmpl.Execute(w, nil) // or whatever
}

And then you can call this endpoint in the same way as other endpoints, with path /myservice.MyHandler

The other aspect of your question is around RESTFul routes, which we don't have good support for today. It's something we definitely want to add, we just need to figure out the best way to design it. I have some ideas but st…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@dangdennis
Comment options

@eandre
Comment options

@dangdennis
Comment options

Answer selected by dangdennis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants