Skip to content

This npm package allows you to easily post a blog article to the medium

Notifications You must be signed in to change notification settings

Arindam200/mediumblog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@arindam1729/mediumblog

This npm package allows you to easily post a blog article to the Medium. It provides a function called postBlog that takes in an article object and an API key as parameters. The function returns a promise that resolves to the response data from the API.

Installation

To install the package, run the following command:

npm install @arindam1729/mediumblog

Usage

First, import the package:

const { postBlog } = require('@arindam1729/mediumblog');

Then, use the postBlog function to post a blog article:

const article = {
  // Specify the properties of the article object here
};

const apiKey = 'YOUR_API_KEY';

postBlog(article, apiKey)
  .then(response => {
    // Handle the response data here
  })
  .catch(error => {
    // Handle any errors here
  });

Make sure to replace 'YOUR_API_KEY' with your actual dev.to API key.

Example

Here's an example of how to use the postBlog function:

const article = {
     title: "Publishing Article on Medium | by Arindam",
     contentFormat: "markdown",
     content: "# Here's a Basic markdown.\n***\nHope This Helps You",
     canonicalUrl: "https://arindam1729.hashnode.dev",
     tags: ["Medium", "Blog", "Arindam"],
     publishStatus: "public"
}

const apiKey = 'YOUR_API_KEY';

postBlog(article, apiKey)
  .then(response => {
    console.log('Article posted successfully:', response);
  })
  .catch(error => {
    console.error('Error posting article:', error);
  });

API

postBlog(article, apiKey)

  • article (Object): The article object to be posted. It should contain properties such as title, body, and tags.
  • apiKey (string): The API key required to access the dev.to API.

Returns a promise that resolves to the response data from the API.

License

This project is licensed under the MIT License.

About

This npm package allows you to easily post a blog article to the medium

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published