Corona networking

Can anybody tell me how to communicate with couchDB database server with corona lua? The server returns jason data. I have never used corona’s networking functions apart from using 3rd party tools like noobhub.

example commands…

Accessing server information Request: curl http://127.0.0.1:5984/ Response: { "couchdb": "Welcome", "version":"1.1.0" } Creating a database named wiki Request: curl -X PUT http://127.0.0.1:5984/wiki Response: {"ok": true}

Anyone? please…

You would use the network.request() API.  See http://docs.coronalabs.com/api/library/network/request.html

I have no experience with CouchDB and there may not be a lot of help around here on it.   As a quick (and very untested example):

local json = require("json") local function requestListener(event)      if event.isError == false then           print(event.response)           local returnedData = json.decode(event.response)     end end   network.request("http://127.0.0.1:5984/wiki", "PUT", requestListener)

or something like that.

Anyone? please…

You would use the network.request() API.  See http://docs.coronalabs.com/api/library/network/request.html

I have no experience with CouchDB and there may not be a lot of help around here on it.   As a quick (and very untested example):

local json = require("json") local function requestListener(event)      if event.isError == false then           print(event.response)           local returnedData = json.decode(event.response)     end end   network.request("http://127.0.0.1:5984/wiki", "PUT", requestListener)

or something like that.