![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
endpointsjs
Advanced tools
Simple helper library for HTTP service clients. Endpoints works in the browser and in Node, using RequestAdapter to expose a common interface for Request Response objects, and superagent for Node and browser AJAX.
View the Endpoints API Reference.
var Endpoints = require('endpointsjs');
var myEndpoint = Endpoints.create('/some/url/pattern')
.header('Content-Type', 'application/json')
.methods(['get', 'post']);
myEndpoint.get()
.send() // Returns an Q Promise (Promises/A+)
.invoke('text') // You may invoke any method a RequestAdapter implements
.done(console.log);
npm install endpointsjs
Use Endpoints to create an endpoint pattern, then call methods on that pattern and get promises back. No pyramid of doom. Code over configuration.
var Endpoints = require('endpointsjs');
var myEndpoint = Endpoints
.create('/some/url/pattern')
.header('Content-Type', 'application/json')
.methods(['get', 'post']);
var promise = myEndpoint
.get()
.send(); // Returns an Q Promise (Promises/A+)
// You can do something like this
promise
.then(function(requestAdapter) {
return requestAdapter.text();
})
.done(function(text) {
console.log(text);
});
// Which is equivalent to
promise
.invoke('text')
.done(console.log);
Sending data to the server is also easy
var myOtherEndpoint = Endpoints.create('/some/other/url/pattern')
.methods(['options', 'post', 'delete']);
myOtherEndpoint.post()
.data({myData: 123})
.send()
...
.done();
It is also possible to build a URL by passing arguments
var myOtherEndpoint = Endpoints
.create('/users/[userId]-[username]')
.methods('get');
myOtherEndpoint
.post()
.param('userId', 123)
.param('username', 'kahnjw')
.send() // GETs the URL: /users/123-kahnjw
...
.done();
Bug fixes, new features, doc fixes are welcome and ecouraged. Open your pull early, make sure the code lints without error and the tests pass.
$ git clone git@github.com:kahnjw/endpoints.git
$ cd endpoints
$ npm install
$ gulp lint
$ gulp browserspec
$ gulp nodespec
Or just use the watch task
$ gulp watch
If new features are added or a bug is fixed, please cover them with new tests.
Keep in mind this library is targeting both browser and Node environments.
Footprint size should be as small as possible. To help with this there is a
footprint
task:
$ gulp footprint
[gulp] Using gulpfile ~/Documents/endpoints/gulpfile.js
[gulp] Starting 'footprint'...
[gulp] gulp-size: total 57.35 kB
index.js
└─┬ create.js
├─┬ http-method-helper.js
│ └─┬ http-method.js
│ ├── ../node_modules/lodash/dist/lodash.js
│ ├─┬ ../node_modules/qagent/index.js
│ │ └── ../node_modules/q/q.js
│ └─┬ ../node_modules/superagent/lib/client.js
│ ├── ../node_modules/superagent/node_modules/component-emitter/index.js
│ └── ../node_modules/superagent/node_modules/reduce-component/index.js
├─┬ ../node_modules/requestadapter/src/index.js
│ ├── ../node_modules/requestadapter/src/xhr-adapter.js
│ └── ../node_modules/requestadapter/src/node-request-adapter.js
└── ../node_modules/lodash/dist/lodash.js
[gulp] Finished 'footprint' after 1.4 s
This prints out the minified size of the library, and the dependency tree to ensure that no libraries are double included.
0.3.5
FAQs
Simple library for HTTP service clients
The npm package endpointsjs receives a total of 21 weekly downloads. As such, endpointsjs popularity was classified as not popular.
We found that endpointsjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.