Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

sword-connect

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sword-connect

connect middleware for sword-system

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
4
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

sword-connect NPM version Build Status

connect middleware for sword group

Installation

$ npm install --save sword-connect

Usage

var koa = require('koa')
var swordConnect = require('sword-connect');

var app = koa()
app.use(swordConnect(opts))

app.use(function *() {
    var rst1 = yield this.connect.get('YOUR-API-URL', {}, opts)  
    var rst2 = yield this.connect.post('YOUR-API-URL', {}, opts)  
})

Methods

  • get
  • post

specify example/test.js to get more usage.

Configuration

opts default value as follows,

{
    hostname: '', // host here will be ip or domain
    port: '80',
    timeoutLimit: 5e3,
    enableLogger: false
}
  • hostname, ip or domain, required
  • port, default is 80
  • timeoutLimit, request timeout, default is 5000ms
  • enableLogger, use sword-logger to log request and response, and more thing to be done. default is false

License

MIT © gejiawen

Keywords

sword

FAQs

Package last updated on 12 Oct 2016

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