marcos@inaka.net / github: amilkr
hello@inaka.net github: inakahttp://www.inaka.net
My name is Marcos Almonacid, I'm from Argentina. I study computer science at Universidad Tecnologica Nacional. I've been working on erlang applications for about 3 years now. Before that I worked with ruby mainly. And currently I'm a developer at Inaka, where I worked on some really cool applications, like Whisper. Inaka is an US company with offices in Argentina. we have a quite large team of erlangers. we build end to end applications mainly with erlang, ruby, IOS and Android. We also do Erlang consulting. Ok. Lets get started.curl -vX GET http://localhost:4004/news
> GET /news HTTP/1.1 > User-Agent: curl/7.30.0 > Host: localhost:4004 > Accept: */* > < HTTP /1.1 200 OK < transfer-encoding: chunked < connection: keep-alive < server: Cowboy < date: Thu, 07 Nov 2013 14:31:10 GMT < content-type: text/event-stream < event: old_news_flash data: The first news flash data: This is an old news flash. keep waiting for moreWith the get endpoint we can start listening for news from the server. - When the communication starts, the server will retrieve all the newsflashes from the db. and it will keep the connection opened.
curl -vX POST http://localhost:4004/news -H"Content -Type:application/json" -d'{ "title": "This is the title for the news flash", "content": "And this is the content...." }'
> POST /news HTTP/1.1 > User-Agent: curl/7.30.0 > Host: localhost:4004 > Accept: */* > Content-Type:application/json > Content-Length: 50 > < HTTP /1.1 204 No Content < connection: keep-alive < server: Cowboy < date: Fri, 08 Nov 2013 20:06:01 GMT < content-length: 0 <With the POST we send a newsflash to the server. It will store the newsflash in mysql using sumodb...
curl -vX GET http://localhost:4004/news
> GET /news HTTP/1.1 > User-Agent: curl/7.30.0 > Host: localhost:4004 > Accept: */* > < HTTP /1.1 200 OK < transfer -encoding: chunked < connection: keep-alive < server: Cowboy < date: Thu, 07 Nov 2013 14:31:10 GMT < content -type: text/event -stream < event: old_news_flash data: The first news flash data: This is an old news flash. keep waiting for more event: news_flash data: This is the title for the news flash data: And this is the content...And also it will send the newsflash to the opened connections. -