1.2.3 • Published 3 years ago

empathy-api-handler v1.2.3

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

Installation

Current Version - v1.2.3

npm i empathy-api-handler

Usage

create a 'handler.ts' to initialize the class and export it;

import { ApiHandler } from 'empathy-api-handler';

const basePath = "http://localhost:3333/api";

export const apiHandler = new ApiHandler(basePath);

now when using in other files you can import and use it with your instance:

import { apiHandler } from "./handler";

const route: string = "/login";
const payload: Object = {
    email: "test@email.com",
    password: "test123",
};
const response = await apiHandler.POST({ route, payload });

OPTIONS

These are the default options:

{
  route: string;
  payload: Payload;
  cookie?: string;
  credentials?: RequestCredentials; // "include" | "same-origin" | "omit"
  return_json?: boolean;
}
1.2.3

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago