Are there examples using rescript-nodejs for the GET/POST requests using the HTTP module of Node.js? I wanted to perform a GET request for a service running on my localhost from an express.js (rescript-express) route handler:
app->get("/api/items/:id/itemDetail.json", (req, res) => {
open NodeJs
let params = req->params
let itemId = params["id"]
let url = "http://localhost:8000" ++ "/api/items/"++itemId ++"/itemDetail.json"
let request = Http.get(url)
let _ = res->status(200)
})
How do I stick the data and end events into the callback from this example here. I do know that I need to use the Http.getWithCallback binding, but I don’t know how. Any hints?