this is migration from YapiJS, KonekJS used different config of YapiJS
New :
Now you can emmbed these config to your application And Cookie support
npm i KonekJS
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()
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 can import from KonekJS
import {config} from "KonekJS"
after import you can contruc your config using new
keyword
const conf = new config()
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'
do you want to logging your request ? Set it true if you want
conf.log = true
if you set it true all in your config will be not executed
conf.production = true
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.