0.52.0 • Published 4 years ago

make-request v0.52.0

Weekly downloads
6
License
ISC
Repository
github
Last release
4 years ago

Make HTTP requests through a standard interface on both the client and the server:

var makeRequest = require("make-request")

makeRequest({
  method: "get",
  url: "http://google.com"
}, function(html) {
  console.log(html)
})

Do the same thing in the browser, with browser bridge support:

var bridge = new require("browser-bridge")

var makeSpaghetti = bridge.defineFunction(
  [makeRequest.defineInBrowser()],
  function(makeRequest) {
    makeRequest({
      method: "post",
      path: "/spaghetti",
      data: {servings: 3},
    }, function(yum) {
      alert(yum)
    })
  }
)

bridge.asap(makeSpaghetti)

var app = require("express")()

app.get("/", bridge.sendPage())

You can also pre-set options which will apply in both the browser and the server:

var element = require("nrtv-element")

var kidFriendly = makeRequest.with({prefix: "/kids"})

var kidButton = element("button", {
  onclick: kidFriendly.defineInBrowser().withArgs("/watermelon").evalable()
})
0.52.0

4 years ago

0.51.0

4 years ago

0.50.0

4 years ago

0.49.0

5 years ago

0.48.0

5 years ago

0.47.0

5 years ago

0.46.0

5 years ago

0.45.0

5 years ago

0.44.0

5 years ago

0.43.0

5 years ago

0.42.0

5 years ago

0.41.0

7 years ago

0.40.0

7 years ago

0.39.0

7 years ago

0.38.0

7 years ago

0.37.0

7 years ago

0.36.0

7 years ago

0.35.0

7 years ago

0.34.0

7 years ago

0.33.0

7 years ago

0.32.0

7 years ago

0.31.0

8 years ago

0.30.0

8 years ago

0.29.0

8 years ago

0.28.0

8 years ago