konekjs

1.0.3 • Public • Published

KonekJS

this is migration from YapiJS, KonekJS used different config of YapiJS

New :

Now you can emmbed these config to your application And Cookie support

Installation

npm i KonekJS

Standalone

you can place this config below to sigle JS file, like APITest.js then call it after server is started node APITest.js

import {config} from "KonekJS"

let conf = new config()
conf.url = "localhost:8888s"
conf.log = true
conf.production = false

conf.createRequest({
    name : "login",
    route   : "/",
    method : "get",
    header  : {
      authorization : "true"
    },
    body : ["file","~/arch.png"],
    responseAs : "ayan"
}).saveRequest()

conf.finish()
conf.start()

With expressJS

Add the following code to your expressjs file on the server, and don't forget place the config.start() in the callback of app.listen()

import {config} from "KonekJS"
import express from "express"

const app = express()
// KonekJS SECTION
let conf = new config()
conf.url = "localhost:8888s"
conf.log = true
conf.production = false

conf.createRequest({
    name : "login",
    route   : "/",
    method : "get",
    header  : {
      authorization : "true"
    },
    body : ["file","~/arch.png"],
    responseAs : "ayan"
}).saveRequest()

conf.finish()
//END SECTION
app.listen(8888,()=>{
    //call START request on callback
    conf.start()
})

config

config can import from KonekJS

import {config} from "KonekJS"

construc the config

after import you can contruc your config using new keyword

const conf = new config()

config.url

adding your url in config.url, this is required to start fetching. If you not assign the config.url your config will be discarded

conf.url = 'localhost:8888'

config.log

do you want to logging your request ? Set it true if you want

conf.log = true

config.production

if you set it true all in your config will be not executed

conf.production = true

config.createRequest()

create a request which given field on value dont forget call conf.createRequest(...).saveRequest() to save your request, if not your request will be discarded

conf.createRequest({
    name : "login",
    route   : "/",
    method : "get",
    header  : {
      authorization : "true"
    },
    body : ["file","~/arch.png"],
    responseAs : "ayan"
}).saveRequest()

value route,method,and name are required, if empty will discard the request. you can use $REF(<fieldInConfig>) to get value on field config. If you want to save your response of your request to config field, you can add responseAs in your request. Disclammer cannot get field on it self.

Readme

Keywords

Package Sidebar

Install

npm i konekjs

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

557 kB

Total Files

9

Last publish

Collaborators

  • aryarte