1.0.4 • Published 3 years ago

tcn-service v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

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)
1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago