Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gangway

Package Overview
Dependencies
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gangway - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

4

CHANGELOG.md
# Changelog
## 1.1.2
- Resource CREATE operation should post to resource root path
## 1.1.1

@@ -4,0 +8,0 @@

@@ -29,3 +29,3 @@ # Hello Gangway

method : 'GET',
path : 'users/{id?}
path : 'users/{id?}'
}

@@ -79,2 +79,42 @@ }

## The resource method.
For RESTful API endpoints, manually producing a route for every action
is tedious. In light of this, Gangway provides an additional
`resource` method for quickly building routes for RESTful resources:
```javascript
API.resource('users')
```
This is functionally equivalent to:
```javascript
API.route({
users: {
create: {
method: 'POST',
path: 'users/{id}'
},
read: {
method: 'GET',
path: 'users/{id?}'
},
update: {
method: 'PATCH',
path: 'users/{id}'
},
destroy: {
method: 'DELETE',
path: 'users/{id}'
}
}
})
```
## Wrapping up

@@ -81,0 +121,0 @@

@@ -15,2 +15,3 @@ # Gangway Documentation

body : The request body
headers : Request headers.
method : Request method (GET, POST, PUT, PATCH, DELETE, etc...)

@@ -17,0 +18,0 @@ beforeSend : Configure an instance of superagent before the request is sent

2

package.json
{
"name": "gangway",
"version": "1.1.1",
"version": "1.1.2",
"description": "A client-side API abstraction layer",

@@ -5,0 +5,0 @@ "main": "src/api.js",

@@ -53,3 +53,3 @@ # Gangway

```javascript
// this is equivalent to creating a create, read, update, and destroy
// This is equivalent to creating a create, read, update, and destroy
// route. Options are folded into every route.

@@ -62,9 +62,9 @@ API.resource("comments", {})

```javascript
// this will send a request to GET http://example.com/users
// 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
// This will send a request to GET http://example.com/users/10
API.users.read({ params: { id: '10' } })
// the same is true for routes added via API.resource
// The same is true for routes added via API.resource
API.comments.read({ params: { id: '2' }})

@@ -75,4 +75,4 @@ ```

Documentation is a work in progress, however checkout the ./docs
folder for guides and information about the API (as it is completed).
See the available options below, or consider working through the
[Hello Gangway](./docs/guides/hello-gangway.md) guide.

@@ -84,2 +84,3 @@ ### Available options

body : The request body
headers : Request headers,
method : Request method (GET, POST, PUT, PATCH, DELETE, etc...)

@@ -95,2 +96,4 @@ beforeSend : Configure an instance of superagent before the request is sent

Additionally consider skimming through the [./docs](./docs) folder.
***

@@ -97,0 +100,0 @@

@@ -9,3 +9,3 @@ var assign = require('./assign')

method: 'POST',
path: name + '/{id}'
path: name
}),

@@ -12,0 +12,0 @@

@@ -16,3 +16,3 @@ var API = require('../src/api')

it ('generates a create route', function() {
assert.equal(api.users.create.config.path, 'users/{id}')
assert.equal(api.users.create.config.path, 'users')
assert.equal(api.users.create.config.method, 'POST')

@@ -19,0 +19,0 @@ })

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc