DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Usaid
Usaid

Posted on

Simple way to use dev.to article API to show your articles on your portfolio website.

Do you want to set your dev.to articles to appear on your portfolio website?
Let me show you how I used the article API to get my dev.to posts on my portfolio website in just two steps.

  1. Just add your username at the end of this API-link: "https://dev.to/api/articles?username=yourUserName"
  2. Use axios to get your posts and then render it on the frontend.

simple example:

const getDevToPosts = () => {
axios
.get("https://dev.to/api/articles?username=usaidpeerzada")
.then((res) => {
setBlogState(res.data);
});
};

Top comments (2)

Collapse
 
bazalduadw profile image
Bazaldua

Thanks!

Collapse
 
chinonsoike profile image
Chinonso Ikewelugo

Hi, thanks for this! The API returns the description truncated with "...". Is there a way to get the full body of the article?

typescript

11 Tips That Make You a Better Typescript Programmer

1 Think in {Set}

Type is an everyday concept to programmers, but it’s surprisingly difficult to define it succinctly. I find it helpful to use Set as a conceptual model instead.

#2 Understand declared type and narrowed type

One extremely powerful typescript feature is automatic type narrowing based on control flow. This means a variable has two types associated with it at any specific point of code location: a declaration type and a narrowed type.

#3 Use discriminated union instead of optional fields

...

Read the whole post now!