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: 439
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

wapi - async HTTP library

Post by Ulydev » Thu Jan 05, 2017 2:00 pm

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 » Sat Jan 07, 2017 9:18 pm

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: 2732
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: wapi - async HTTP library

Post by zorg » Sat Jan 07, 2017 10:47 pm

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: 331
Joined: Wed Oct 30, 2013 8:59 pm

Re: wapi - async HTTP library

Post by alberto_lara » Sun Jan 08, 2017 6:52 am

Cool, I'm going to definitely check it out :)
LÖVE Projects: GOOi, Süsse and Katsudö
Thank you for taking the time to read this

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests