Socket
Socket
Sign inDemoInstall

@huolala-tech/nad-runtime

Package Overview
Dependencies
Maintainers
0
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huolala-tech/nad-runtime

The runtime lib of the Nad project


Version published
Maintainers
0
Created
Source

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();
};

FAQs

Package last updated on 18 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc