Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.
/ json-fetcher Public archive

NPM package for managing data from social media API.

License

Notifications You must be signed in to change notification settings

esign/json-fetcher

Repository files navigation

jsonFetcher

NPM package for managing data from an API.

Installation

Install package:

npm i @esign/json-fetcher

Import package in Javascript file:

import JsonFetcher from '@esign/json-fetcher';

Create new JsonFetcher instance:

const instance = new JsonFetcher();

Pass options to JsonFetcher class:

const instance = new JsonFetcher({
  element: '.js-json-fetcher',
  template: '.js-json-fetcher__template',
  api: API_URL,
  keys: ['url', 'photo'],
});

Replace API_URL with your api url

Options:

property default attribute-way
element null /
template '.js-json-fetcher__template' /
api null 'data-api'
keys null 'data-keys'