Indeed, we planed to return ok or json based on subdomain like www.domain.com or api.domain.com with one controller. Appreciate your remind.
------------------ 原始邮件 ------------------ 发件人: "Konstantin";<k.n.gorsh...@gmail.com>; 发送时间: 2017年10月26日(星期四) 凌晨4:26 收件人: "chicagoboss"<chicagoboss@googlegroups.com>; 主题: Re: [chicagoboss] controllers for template and json I think you used different URLs to serve html and json. But the common solution is to use the header "Accept" in an HTTP request and build an output based on it value, not an URL. With this approach you can use one controller to produce a data with different mime-types. More: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept On 10/25/2017 02:31 PM, 2316134491 wrote: Hi, We are building a server to serve ordinary web pages by ok->ErlyDTL, also as backend api server to provide json data. The data to serve is the same, if we write 2 controllers, one with {ok, Values} for web page and one with {json, Values}, most code of the controllers will be duplicated. Is there better way to do it? Thanks. -- You received this message because you are subscribed to the Google Groups "ChicagoBoss" group. To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/chicagoboss. To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/tencent_EFD0EEB826B3474F38F36FD27784361A7B08%40qq.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "ChicagoBoss" group. To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/chicagoboss. To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/e0a2a3c5-f9d4-74cd-b4cf-29545da877f5%40gmail.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "ChicagoBoss" group. To unsubscribe from this group and stop receiving emails from it, send an email to chicagoboss+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/chicagoboss. To view this discussion on the web visit https://groups.google.com/d/msgid/chicagoboss/tencent_69696F42770D3DE87CDCE459E727A2793B07%40qq.com. For more options, visit https://groups.google.com/d/optout.