Socket
Socket
Sign inDemoInstall

gangway

Package Overview
Dependencies
24
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.1.0

src/resource.js

4

CHANGELOG.md
# Changelog
## 1.1.0
- Add resource API as shorthand for RESTful resources
## 1.0.1

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

11

example/index.js

@@ -10,9 +10,10 @@ var Gangway = require('../src')

API.resource("users")
API.route({
users: {
comments: {
read: {
method : 'GET',
path : '/users/{user_id?}'
},
mock: { foo: 'bar' }
method: "GET",
path: "/comments"
}
}

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

{
"name": "gangway",
"version": "1.0.1",
"version": "1.1.0",
"description": "A client-side API abstraction layer",

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

@@ -35,2 +35,6 @@ # Gangway

// this is equivalent to creating a create, read, update, and destroy
// route. Options are folded into every route.
API.resource("comments", { query: {} })
// this will send a request to GET http://example.com/users

@@ -37,0 +41,0 @@ API.users.read()

var ajax = require('./ajax')
var route = require('./route')
var resource = require('./resource')

@@ -24,2 +25,6 @@ module.exports = function (config, routes) {

return route(API, routes)
},
resource: function (routes, options) {
return resource(API, routes, options)
}

@@ -26,0 +31,0 @@

var remap = require('./remap')
var prepare = require('./prepare')
module.exports = function route(API, routes) {
module.exports = function route (API, routes) {
return remap(routes || {}, function(resource) {
// For each endpoint (create, read, update, delete...)

@@ -9,0 +8,0 @@ return remap(resource, function(options) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc