Skip to content

Instantly share code, notes, and snippets.

@s4cha
Last active October 17, 2016 16:37
Show Gist options
  • Save s4cha/3fb0d867a556120589a5f16ef076b293 to your computer and use it in GitHub Desktop.
Save s4cha/3fb0d867a556120589a5f16ef076b293 to your computer and use it in GitHub Desktop.
import ws
import then // Needed to import Promise Type
import Arrow // Needed to import JSON Type
let api = Api() // Define global api
struct Api {
// Connect to the base URL
private let ws = WS("http://jsonplaceholder.typicode.com")
// Declare your route and what you want back, here some JSON
func getUsers() -> Promise<JSON> {
return ws.get("/users")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment