Package Exports
- comfortable-javascript
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (comfortable-javascript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Javascript Development Kit
Installation
NPM
Run this command:
npm install comfortable-javascriptFor usage in the Browser
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/comfortable-javascript@latest/dist/comfortable.min.js"></script>Note: For a specific version replace
@latestwith the version of your choice.
The SDK will be available as a global variable called: Comfortable
Downloadable version
Check out our release Page: https://github.com/cmftable/comfortable-javascript/releases
Include the dependency:
const Comfortable = require('comfortable-javascript');Connect to your Repository and make your first request:
const api = Comfortable.api('{repository-api-id}', '{api-key}', options);
api.getDocuments()
.then(result => {
// futher implementation
})
.catch(err => {
throw err;
})Complete documentation, installation instructions, and examples are available here.
Options:
| Option | Type | Description |
|---|---|---|
| useProxy | boolean | enables the usage of a Proxy Endpoint instead of using https://api.cmft.io/v1 |
| proxy | string | Proxy Url e.g. https://custom-api.com/v1 |
Tests
- npm is a prerequisite for running the tests. Install npm on your system, then run
npm installto install required files. - Edit
tests/Api.tsto add your credentials and test documents. Alternatively you can set your credentials as environment variables. For this you have to defineCMFT_REPOSITORY,CMFT_APIKEY,CMFT_DOCUMENT_ID,CMFT_DOCUMENT_ALIAS.CMFT_ASSET_ID.CMFT_PROXY_URL. - The tests can be executed by running the following command from the root directory:
npm run test
// or
CMFT_REPOSITORY=... CMFT_APIKEY=... CMFT_DOCUMENT_ID=... CMFT_DOCUMENT_ALIAS=... CMFT_ASSET_ID=... CMFT_PROXY_URL=... npm run testMore information
Contributing
Pull requests are always welcome!
License
This repository is published under the MIT license.