You are not logged in.
Pages: 1
Hi,
from the documentation I understand, that I can just append a 'json' to a url (as the last part before any parameters) and then just get the data context instead of the processed mustache template.
This basically works great but there's a problem with redirecting in this case.
Using the Sample "30 - MVC Server" I can call .../blog/login?LogonName=usrname&PlainPassword=abcd and get redirected to .../blog/default - which is correct.
However, if I call .../blog/login/json?LogonName=usrname&PlainPassword=abcd then I get redirected to .../blog/login/Default which doesn't exist and causes an Error 400. Somehow rewriting the url doesn't work if "json" is appended ...
If in this second case the redirection would redirect to .../blog/Default/json it would be possible to write an mvc application which uses html templates for creating html and at the same time I could write a fat client in some client language or a javascript client which makes use of the .../json urls. That way I would only have one server which can be used by different types of client easily.
Currently I can't do that because the automatic TMVCAction redirection doesn't work for urls which have the .../json appended.
Martin
Offline
I think it would be better to create a separate endpoint (service), on the same server.
Example:
/blog/... to pages (HTML)
/api/.. to services (JSON)
Offline
Yes, that's one way. My initial idea was to have a MVC web application (just pure html, created with mustache templates) which at the same time could be used e.g. by a single page javascript web app which just calls the same urls but appends json to the existing urls. That would work if the redirection also were to work with the .../json urls.
If that redirection doesn't work, I need two different implementations of a server method for basically the same thing (e.g. in the case of the Login method of the example). Maybe that's a better way.
Offline
Pages: 1