https://github.com/matter-in-motion/mm-client-nodejs
Node.js client
https://github.com/matter-in-motion/mm-client-nodejs
api client matter-in-motion nodejs
Last synced: about 1 month ago
JSON representation
Node.js client
- Host: GitHub
- URL: https://github.com/matter-in-motion/mm-client-nodejs
- Owner: matter-in-motion
- License: mit
- Created: 2018-04-03T20:44:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-01-03T18:17:07.000Z (over 7 years ago)
- Last Synced: 2025-10-30T00:56:01.067Z (8 months ago)
- Topics: api, client, matter-in-motion, nodejs
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Matter In Motion. Node.js client
[](https://www.npmjs.com/package/mm-client-nodejs)
[](https://www.npmjs.com/package/mm-client-nodejs)
Node.js client for [matter in motion](https://github.com/matter-in-motion/mm) framework
## Installation
`npm i mm-client-nodejs`
## Usage
```js
const client = require('mm-client');
const mm = client({
host: 'localhost:3000'
});
mm('?').then(res => console.log(res));
```
### client(opts)
Creates a client function. Options:
* **host** – string, API host. IP or domain.
* tls — boolean, default `false`. Use TLS (https) connection or not.
* api — string, default `/api`. API path
* serializer — serializer to use. By default client uses JSON serializer except for sending files it uses FormData.
* meta – request metadata, will be used in every request with empty meta
### mm(call, data, opts)
Makes a call. Returns a Promise.
* **call** — string, resource call
* data — object, data to send
* opts
- header — object, headers to add to the request
- meta — metadata to send with the request
- files — the array of paths or streams to send
- agent — as in [https://github.com/sindresorhus/got#proxies](https://github.com/sindresorhus/got#proxies)
License: MIT