Connect, grab and process :) My server needs to call out to 2 different APIs, take both sets of results to merge and process then pass back to the client.
On Tuesday, 5 August 2014 11:15:57 UTC+1, Sergey Lyubka wrote: > > Do you want just to proxy the request to the external host? > Or, connect to the external host, send request, grab the reply, process > it, and send back processed data to the client? > > > On Tue, Aug 5, 2014 at 11:11 AM, Charlie Scott-Skinner < > [email protected] <javascript:>> wrote: > >> >> >> Hi, >> >> I am attempting to write my first server, and I've found many things to >> facilitate that, but Mongoose is by far the most attractive :) >> >> However, I am really struggling to find any information or examples out >> there beyond the 6 on here http://cesanta.com/docs/Embed.shtml (where >> the 'upload.c' link is goes to 'post.c' BTW). >> >> Does anyone have an example of how to call out to an external REST API? >> >> I'm not interested in serving my own - I think I understand how to do >> that. >> But I need to be able to call out to others... >> >> I have created a connection to the API, but I don't seem to be able to do >> anything beyond that. >> I've intercepted the connect event, but I can't modify anything within >> the connection structure... >> >> I was trying this... >> >> case MG_WS_CONNECT: >> { >> connection->uri = >> "/gapi/translate?from=eng&dest=fra&format=xml&phrase=cat&pretty=true"; >> connection->request_method = "GET"; >> >> result = MG_TRUE; >> } >> break; >> >> ...but connection->uri and request_method still show NULL after >> this because they are const char * I guess. >> >> Am I supposed to create yet another connection at this point with the >> full API request URL? >> But then how do I set the request type? >> >> Or am I chasing ghosts...? >> Is Mongoose only good for serving REST APIs, but cannot call out to them? >> >> >> >> Kind regards, >> Charlie >> >> >> P.S: any links to any other resources, manuals, help or examples would be >> hugely appreciated and Google is not as fruitful as I'd hope :| >> >> -- >> You received this message because you are subscribed to the Google Groups >> "mongoose-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/mongoose-users. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "mongoose-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mongoose-users. For more options, visit https://groups.google.com/d/optout.
