http decorator
axios + kaop-ts = <3
This library allows to easily implement AJAX calls without messing with Async stuff and with the same axios API.
You only have to include this decorator in one method, then the decorated method will be threated as then or catch for the call. Only receiving the params.
This tiny project is also a demo about writing custom decorators using kaop-ts API
Get Started
install: npm install http-decorator
import: import { http } from 'http-decorator';
usage:
@ public
You should wrap this decorator with another function to set global axios options like headers or so:
; // wrap a decorator to pass default argumentsconst get = const post = const put = ... // using the wrapper decorator @ public {} someClassInstance;// $ curl http://jsonplaceholder.typicode.com/users}
How it works -> 17 lines
const axios = ;const beforeMethod = ; moduleexports = ;