# hashnode-api

> React functions that help you fetch articles and create articles in hashnode

Latest version **0.1.1** (published 2021-09-19) · 0 weekly downloads

## Install

```sh
npm install hashnode-api
pnpm add hashnode-api
yarn add hashnode-api
bun add hashnode-api
```

Provides the command `hashnode-api`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2021-09-19 |
| First published | 2021-09-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 12.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | sarulatha |
| Keywords | hashnode, hashnode-api, hashnode-blog, react, hashnode-stories, hashnode-createstory |

## Links

- npm: https://www.npmjs.com/package/hashnode-api
- npm.io page: https://npm.io/package/hashnode-api

## Dependencies (7)

- [react](https://npm.io/package/react.md) ^17.0.2
- [react-dom](https://npm.io/package/react-dom.md) ^17.0.2
- [web-vitals](https://npm.io/package/web-vitals.md) ^1.0.1
- [react-scripts](https://npm.io/package/react-scripts.md) 4.0.3
- [@testing-library/react](https://npm.io/package/@testing-library/react.md) ^11.1.0
- [@testing-library/jest-dom](https://npm.io/package/@testing-library/jest-dom.md) ^5.11.4
- [@testing-library/user-event](https://npm.io/package/@testing-library/user-event.md) ^12.1.10

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2021-09-19
- 0.1.0 — 2021-09-19

## README

# hashnode-api

![hashnode-cover](https://res.cloudinary.com/practicaldev/image/fetch/s--ByKpo_Aw--/c_imagga_scale,f_auto,fl_progressive,h_420,q_auto,w_1000/https://dev-to-uploads.s3.amazonaws.com/i/lxil6ifcwdx3fkukypc1.png)

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](https://img.shields.io/npm/v/react-use-medium?logo=npm&style=flat-square)
![GitHub](https://img.shields.io/github/license/dheerajmahra/react-use-medium?style=flat-square)


## Live Demo

[CodeSandBox](https://codesandbox.io/s/hashnode-api-g8s2b)

## Install

```
npm install hashnode-api
```

## Import

### For fetching articles from hashnode

```js
import {GetArticles} from "hashnode-api";
```

## Usage

```js
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

```js
import {CreateArticle} from "hashnode-api";
```

## Usage

```js
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"
  };

```

---
_Source: https://npm.io/package/hashnode-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
