npm.io
1.0.4 • Published 5 years ago

tcn-service

Licence
ISC
Version
1.0.4
Deps
2
Size
3 kB
Vulns
23
Weekly
0

What is this?

For the moment the package is WIP, more stuff to be added soon.


Installation:

npm install tcn-service or yarn add tcn-service

Testing the package

import { tcn } from 'tcn-service';

tcn(); //this should display a Success message

Mocked Endpoints:


[GET] on /formSchema 
import { getMokedForm } from 'tcn-service';

async function returnRequestData() {
	const res = await getMokedForm('https://demo5655985.mockable.io');
	return res.data;
};

Swagger Endpoints:

import { ApiService } from 'tcn-service';

async function returnRequestData() {

  const apiServiceInstance = ApiService; //initialize class instance

  apiServiceInstance.setHeaders("http://20.82.216.130", "/data/salutations");
  // setHeaders takes the base URL as the first argument
  // the second argument is the rest of the API endpoint context

  const res = await apiServiceInstance.get();

  console.log(res.data);
}

Actions accepted on the instance:

.get()
.get(id)
.post(Payload ={})
.post(Payload ={}, id)
.delete(id)

Keywords