hashnode-api

0.1.1 • Public • Published

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);
Argument Description
USERNAME : String Your hashnode username
page : Int The page number that you want to retrieve
Returns Description
data : object an object having user's information and stories;
isFetched : boolean true if username is a valid username and data has been fetched; false for all other scenarios
error : boolean true 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);
Argument Description
input : object Object data required to create story
TOKEN : string Token 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"
  };

Package Sidebar

Install

npm i hashnode-api

Weekly Downloads

0

Version

0.1.1

License

none

Unpacked Size

12.6 kB

Total Files

9

Last publish

Collaborators

  • sarulatha