
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
A client-side API abstraction layer
Gangway is our general purpose tool for working with APIs on the
client-side. It is a thin layer on top of superagent
with specific
opinions related to how we work.
Gangway is a factory function that progressively layers configuration
options for building an AJAX request with superagent
:
let Gangway = require('../src')
let API = Gangway({
baseURL: 'http://example.com',
headers: {
'x-api-key': 'your-token-for-every-request'
}
})
API.route({
users: {
get: {
method : 'GET',
path : '/users/{id?}' // ? indicates that the parameter is optional
}
}
})
// this will send a request to GET http://example.com/users
API.users.read()
// this will send a request to GET http://example.com/users/10
API.users.read({ params: { id: '10' } })
Documentation is a work in progress, however checkout the ./docs folder for guides and information about the API (as it is completed).
baseURL : The base URL prepended to all requests
body : The request body
method : Request method (GET, POST, PUT, PATCH, DELETE, etc...)
beforeSend : Configure an instance of superagent before the request is sent
onResponse : Run before resolving a request for preprocessing data
params : Populate bindings in paths and are sent as request bodies. Defaults to body.
path : The path fragment of the endpoint, appended to baseURL
type : Content type, defaults to JSON
0.11.0
body
option for request body, not params
FAQs
A client-side API abstraction layer
The npm package gangway receives a total of 3 weekly downloads. As such, gangway popularity was classified as not popular.
We found that gangway demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.