“Regular” Restful routes #34
-
I understand encore is geared towards api-only microservices style, but is it possible to still do html templating with restful routes? I’d like to serve a frontend from the same system. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
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 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 still thinking through the different options. |
Beta Was this translation helpful? Give feedback.
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":
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…