Skip to content

noInfoPath/noinfopath-rest-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NoInfoPath RESTAPI Client

Overview

This module allows for easy configuration and execution of CRUD (Create, Read, Update and Delete) functions against an ODATA V4 compliant RESTAPI. It support communicating with multiple REST servers via a simple JSON configuration schema. All communications between the client and the servers are via standard JWT bearer tokens.

References

Installation

npm install noinfopath-rest-client --save

Usage

var platform = "debug",
	config = require("../config")[platform],
	restClient = require("../rest-client")(config),
	assert = require("assert"),
	sopSamples = require("./fixtures/sop-request.js"),
	okResponse;

describe("Testing restClient", function(){
	it("Read called with no parameters should return at least one record.", function(done){
		restClient.sop.requests.read()
			.then(function(resp){
				assert(resp.length > 0);
				done();
			})
			.catch(function(err){
				done(err);
			});

	});

});

Configuration

{
	"debug": {
		"namespaces": {
			"foo": {
				"schema": {
					"bar": {
						"entityName": "bar",
						"primaryKey": "id"
					}
				},
				"rest": {
					"protocol": "https://",
					"host": "restapi.my-company.com",
					"port": 443,
					"apiPrefix": "/foo/"
				}
			}
		}
	}
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •