javascript - Linking Web UI objects to my REST services -
i'm jumping world of web development. i've built backend code, i've built external rest api gives me access code, , i'm moving onto front end. what's efficient , elegant way consume rest api front end?
i have rest api methods:
public class externalcontroller : apicontroller { [httpget] [route("getstringformats")] public httpresponsemessage getstringformats() { basicresponse<list<string>> response = new basicresponse<list<string>>(); httpstatuscode status; try { response.starttime = datetime.now; response.result = stringformatters.getformatkeys(); // returns list of strings response.status = true; status = httpstatuscode.ok; } catch(exception exc) { response.status = false; response.exceptionmessage = exc.message; response.exceptiontype = exc.gettype().name; status = httpstatuscode.internalservererror; } { response.completed = true; response.endtime = datetime.now; } return request.createresponse(status, response); }
i have html front end. drop down list display list of strings returned getstringformats api.
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <body> <form> <div> <select id="formats"> </select> </div> </form> </body> </html>
here's lost. know i'll need javascript (angular perhaps, that's our team using). so, javascript hit rest api (do hit webserver, or better call locally code?).
there ton of information on exact subject i've not put in way makes sense.
Comments
Post a Comment