0.1.1 • Published 3 years ago

hashnode-api v0.1.1

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

hashnode-api

hashnode-cover

A react function created to fetch articles which can be populated in cards for your portfolio. And also to create posts using their hashnode api.

Npm GitHub

Live Demo

CodeSandBox

Install

npm install hashnode-api

Import

For fetching articles from hashnode

import {GetArticles} from "hashnode-api";

Usage

const {isFetched,data,error} = GetArticles("<USERNAME>",page);
ArgumentDescription
USERNAME : StringYour hashnode username
page : IntThe page number that you want to retrieve
ReturnsDescription
data : objectan object having user's information and stories;
isFetched : booleantrue if username is a valid username and data has been fetched; false for all other scenarios
error : booleantrue if username is not valid username and data has been fetched; false if data is fetched

For creating articles in hashnode

import {CreateArticle} from "hashnode-api";

Usage

CreateArticle(input,TOKEN);
ArgumentDescription
input : objectObject data required to create story
TOKEN : stringToken string of your account that you can get from developer options in hashnode

Sample Input

const input = {
    title: "New Blog", //Title of your blog
    contentMarkdown: `# This is my first Blog`, //Blog content added as markdown
    tags: [
      {
        _id: "56744723958ef13879b9549b",
        slug: "testing",
        name: "Testing"
      }
    ],//tags that you want to include for your blog
    coverImageURL: "https://codybontecou.com/images/header-meta-component.png"
  };