1.0.10 • Published 12 months ago

@huolala-tech/nad-runtime v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

nad-runtime · LICENSE codecov

The runtime lib of the Nad project.

Include

yarn add @huolala-tech/nad-runtime

or

npm install @huolala-tech/nad-runtime --save

Useage

1. @PathVariable

import { NadInvoker } from '@huolala-tech/nad-runtime';

// This code will request http://localhost/users/123 with GET mtehod.
const getUserInfo = async () => {
  return await new NadInvoker('http://localhost').open('GET', '/users/{id}').addPathVariable('id', 123).execute();
};

2. @RequestParam

import { NadInvoker } from '@huolala-tech/nad-runtime';

// This code will request http://localhost/getUser?id=123 with GET mtehod.
const getUserInfo = async () => {
  return await new NadInvoker('http://localhost').open('GET', '/getUser').addRequestParam('id', id).execute();
};

2. @ModelAttribute

import { NadInvoker } from '@huolala-tech/nad-runtime';

// This code will request http://localhost/getUser?id=1&type=2 with GET mtehod.
const getUserInfo = async () => {
  return await new NadInvoker('http://localhost')
    .open('GET', '/getUser')
    .addModelAttribute({ id: 1, type: 2 })
    .execute();
};

4. @RequestBody

import { NadInvoker } from '@huolala-tech/nad-runtime';

// This code will request http://localhost/userService with POST mtehod and send payload {"id":123}.
const getUserInfo = async () => {
  return await new NadInvoker('http://localhost').open('POST', '/userService').addRequestBody({ id: 123 }).execute();
};
1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.10

12 months ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago