Skip to content

Amplify is a wrapper around the NodeJS http packages to help make development easier

License

Notifications You must be signed in to change notification settings

chafnan/amplify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Amplify is a wrapper around the NodeJS http packages to help make calls easier. It is modeled after AmplifyJS. The idea is that you can use this package on the server side and AmplifyJS on the client side.

Build Status

##Getting Started

Install the package

npm install amplify

Require the package

var amplify = require("amplify");

Next, define the services that you will be using

request.define('exampleService', 'ajax', {
  url: 'http://localhost:3000/service',
  dataType: 'json',
  type: 'POST'
});

Lastly, call your service

request({
  resourceId: 'exampleService',
  data: {
    name: 'example',
    anotherProperty: 'another example property'
  },
  success: function(data, status) {
    // success actions go here
  }
  error: function(error, status) {
    // error actions go here
  }
});

##Request This function is intended to make all the requests to the resources.

amplify.request(string resourceId, [hash data], [function callback])

amplify.request(hash settings)

Settings

resourceId: The identifier of the resource
data: The data to be sent
success: The success callback after the request
error: The error callback after the request

Define

Define will take care adding resources that can be used by the request.

amplify.request.define(string resourceId, string type, [hash settings])

Settings

url: The url used for the request
dataType: The content-type that is sent and received
type: The HTTP method that will be used

About

Amplify is a wrapper around the NodeJS http packages to help make development easier

Resources

License

Stars

Watchers

Forks

Packages

No packages published