wapi - async HTTP library

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Ulydev
Party member
Posts: 445
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

wapi - async HTTP library

Post by Ulydev »

Hello,

Here's a little lib that implements async HTTP requests.
It's mainly designed for web REST APIs.

Image

Code: Select all

local wapi = require "webapi"

function love.update(dt)
  wapi.update()
end



request = wapi.request({
  method = "GET",
  url = "http://jsonplaceholder.typicode.com/posts/1"
}, function (body, headers, code)

  print(body)

end)
Check it out on Github :awesome:
User avatar
CrackedP0t
Citizen
Posts: 69
Joined: Wed May 07, 2014 4:01 am
Contact:

Re: wapi - async HTTP library

Post by CrackedP0t »

This is cool... but it would be even cooler if it used coroutines! For example:

Code: Select all

local wapi = require "webapi"

function love.update(dt)
  wapi.update()
end


wapi.do(function()
body, headers, code = wapi.request({
  method = "GET",
  url = "http://jsonplaceholder.typicode.com/posts/1"
})

print(body)
end)
/人 ◕‿‿◕ 人\
Here, have an umlaut. Ö
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: wapi - async HTTP library

Post by zorg »

If speed is an issue, then don't use coroutines, since luaJIT can't/doesn't compile them.
Otherwise, go for it. :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
alberto_lara
Party member
Posts: 372
Joined: Wed Oct 30, 2013 8:59 pm

Re: wapi - async HTTP library

Post by alberto_lara »

Cool, I'm going to definitely check it out :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests