# caronte

> Caronte provides a single interface to fetch data from anywhere.

Latest version **1.2.5** (published 2014-08-20) · 0 weekly downloads

## Install

```sh
npm install caronte
pnpm add caronte
yarn add caronte
bun add caronte
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2014-08-20 |
| First published | 2014-05-12 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.22 |
| Dependencies | 6 |
| Known vulnerabilities | 0 (+5 in 3 direct dependencies) |
| Install scripts | no |
| Author | Icemobile BV |
| Maintainers | icemobile |
| Keywords | service, connector, adapter |

## Links

- npm: https://www.npmjs.com/package/caronte
- Repository: https://github.com/icemobilelab/caronte
- Issues: https://github.com/icemobilelab/caronte/issues
- npm.io page: https://npm.io/package/caronte

## Dependencies (6)

- [q](https://npm.io/package/q.md) 1.0.0
- [soap](https://npm.io/package/soap.md) ^0.4.7
- [colors](https://npm.io/package/colors.md) ~0.6.0-1
- [log4js](https://npm.io/package/log4js.md) 0.6.14
- [request](https://npm.io/package/request.md) ~2.22.0
- [underscore](https://npm.io/package/underscore.md) ~1.6.0

## Recent versions

- 1.2.5 (latest) — 2014-08-20
- 1.2.4 — 2014-06-17
- 1.2.3 — 2014-05-23
- 1.2.1 — 2014-05-12
- 1.2.0 — 2014-05-12

## README

<img src="./images/caronte.png" width="400px" height="250px" align="right" />

# Caronte

Current version: ** 1.0.x **

[![Build Status](https://travis-ci.org/icemobilelab/caronte.svg?branch=master)](https://travis-ci.org/icemobilelab/caronte)


# Usage

The first version of Caronte has a simple interface consisting of three methods:

- register()
- unregister()
- request()


## register(sourceName, sourceParams)
The register method is used to add a new source, specified by the sourceParams object.
It is registered under name sourceName.

The sourceParams object can takes the following form:

	{
		url: 'www.yoursite.com/:param', 					//'param' being a parameter.
		type: 'http', 				                    //One of the sourceTypes, currently only `http`
		method: 'GET',												//or `PUT` or `POST`.
		params: {},							   					//optional: default parameters.
		serializer: function (data) { return data; }, 	//optional: serializer for request.
		deserializer: function (data) { return data; }, //optional: deserializer for reponse.
		json: {},								 					//optional: contents of a request, in JSON form
		headers: {}							   					//optional: headers to add to each request.
	}

If a certain sourceName is already registered, it will be overwritten.

register() can also register multiple sources passed as an object:

	{
		sourceId: sourceOptions,
		//more sources
	}


## unregister(sourceName)
Unregisters a source.


## request(sourceName [, requestParams] [,callback])
Makes a request to the source defined by sourceName.
If it doesn't exist, callback is called with an error.

Callback is a node-style function, which takes an err and a result parameter.

requestParams is an object which takes the following form (http source):

	{
		params: { stamps: 'fooStamp' }  //optional: parameters to insert into the url.
		headers: {}					    //optional: extends headers set at register.
		json: {}						//optional: extends json set at register.
	}

## Caronte in the browser
Caronte can be used in the browser when compiled with browserify.
In this scenario, jQuery needs to be loaded in the page for Caronte to work.

---
_Source: https://npm.io/package/caronte · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
