ft-rest
TypeScript icon, indicating that this package has built-in type declarations

1.1.7 • Public • Published
Logo

Ft-Rest

  • REST module is developed in order to make easier to work with REST API's.
  • This module uses axios for making requests.
  • It is flexible

Simple Installation

$ npm i ft-rest

Example Usage

import "./server.js"; // for development server

import REST from "../dist/index.js";

REST.prototype._responseResolver = (res) => {
  return res.data;
};

// RES
const Routes = {
  getUser: "/api/@me",
};

const rest = new REST({
  baseURL: "http://localhost:3000",
  token: "fristroop.com",
});

const get = await rest.get(Routes.getUser, { id: 1 });
console.log(get);
const post = await rest.post(Routes.getUser, {});
console.log(post);
const put = await rest.put(Routes.getUser, {});
console.log(put);
const remove = await rest.delete(Routes.getUser, {});
console.log(remove);

Readme

Keywords

Package Sidebar

Install

npm i ft-rest

Weekly Downloads

0

Version

1.1.7

License

MIT

Unpacked Size

7.97 kB

Total Files

11

Last publish

Collaborators

  • aydinthefirst