# @microservice-framework/microservice-client

> Client Interface for microservice-framework

Latest version **3.0.0** (published 2025-02-22) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install @microservice-framework/microservice-client
pnpm add @microservice-framework/microservice-client
yarn add @microservice-framework/microservice-client
bun add @microservice-framework/microservice-client
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2025-02-22 |
| First published | 2017-04-15 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 507.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gormartsen |
| Maintainers | microservice-framework |

## Links

- npm: https://www.npmjs.com/package/@microservice-framework/microservice-client
- Repository: https://github.com/microservice-framework/microservice-client
- Homepage: https://github.com/microservice-framework/microservice-client#readme
- Issues: https://github.com/microservice-framework/microservice-client/issues
- npm.io page: https://npm.io/package/@microservice-framework/microservice-client

## Dependencies (2)

- [axios](https://npm.io/package/axios.md) ^1.7.9
- [debug](https://npm.io/package/debug.md) ^4.4.0

## Recent versions

- 3.0.0 (latest) — 2025-02-22
- 1.3.4 — 2018-04-21
- 1.3.3 — 2018-04-10
- 1.3.2 — 2018-03-26
- 1.3.0 — 2018-02-16
- 1.2.5 — 2018-02-14
- 1.2.4 — 2017-05-18
- 1.2.3 — 2017-05-15
- 1.2.2 — 2017-05-13
- 1.2.1 — 2017-05-07
- 1.2.0 — 2017-05-07
- 1.1.1 — 2017-05-02
- 1.1.0 — 2017-04-23
- 1.0.2 — 2017-04-20
- 1.0.1 — 2017-04-15
- … 1 more at https://npm.io/package/@microservice-framework/microservice-client/versions

## README

# microservice-client

[![npm](https://img.shields.io/npm/dt/@microservice-framework/microservice-client.svg?style=flat-square)](https://www.npmjs.com/~microservice-framework)
[![microservice-frame.work](https://img.shields.io/badge/online%20docs-200-green.svg?style=flat-square)](http://microservice-frame.work)

Microservice framework client.


See examples [here](https://github.com/microservice-framework/microservice-client/tree/master/examples).


```html
    <script src="http://microservice-frame.work/js/microservice-client.min.js"></script>
    <script>
$(function() {    
    var clientSettings = {
      URL: "https://apiserver.com/service",
      secureKey: 'ServiceSecureKey'
    }
    client = new MicroserviceClient(clientSettings);
    client.search({}).then((response)=>{
      if(response.error){
        return $('#result').html(response.error);
      }
      $('#result').html(JSON.stringify(response, null, 2));
    });
});

$(function() {    
    var clientSettings = {
      URL: "https://apiserver.com",
      secureKey: 'ServiceSecureKey'
    }
    client = new MicroserviceClient(clientSettings);
    client.search('endpoint', {}).then((response)=>{
      if(response.error){
        return $('#result').html(response.error);
      }
      $('#result').html(JSON.stringify(response, null, 2));
    });
});
    </script>
```


Nodejs:

```js
'use strict';

const MicroserviceClient = require('@microservice-framework/microservice-client');

require('dotenv').config();

var client = new MicroserviceClient({
  URL: "http://localhost:" + process.env.PORT,
  secureKey: process.env.SECURE_KEY
});

var RecordID;
var RecordToken;

client.post({
    name: "Microservice",
    data: {
      value: test
    }
  }).then( (response) => {
    console.log(response);
    if(response.error) {
      return 
    }
    
    RecordID = response.answer.id;
    RecordToken = response.answer.token;
    
    client.search({ name: "Microservice" }).then( (response) => {
      console.log(response);
      if(response.error) {
        return 
      }
    });

    client.get(RecordID, RecordToken).then( (response) => {
      console.log(response);
      if(response.error) {
        return 
      }
    });
    
    
    client.put(RecordID, RecordToken, {
      extra: {
        extravalue: "test2"
      }
    }).then( (response) => {
      console.log(response);
      if(response.error) {
        return 
      }
    });

    client.delete(RecordID, RecordToken).then( (response) => {
      console.log(response);
      if(response.error) {
        return 
      }
    });
    
});

```

## Changelog
- 3.0.0
  - changed replace callback on Promise

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