geeksblabla / moroccan-blog-posts-api

A Simple API to collect Blog Posts from moroccan developers Community.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moroccan Blog Posts API

A Simple API to collect Blog Posts from moroccan developers Community.

This Project is based on blogs RSS feeds.

we are combining RSS feeds from awesome-morocco blogs section

To add your posts, Make sure to add your Blog to awesome-morocco blogs with a valid RSS feed.

Demo

=> https://moroccan-blog-posts-api.netlify.app/demo

Get Started

Get Latest Blog Posts

const API = "https://moroccan-blog-posts-api.netlify.app/";
try {
  const data = await fetch(API);
  const feed = await data.json();
} catch (error) {
  console.log(error);
}

Result :

{
  "total_count": 120,
  "lastUpdate": "2020-07-14T22:47:02.713Z",
  "posts": [
    {
      "title": "The green presence dot",
      "creator": "Ahmed",
      "date": "6/29/2020",
      "link": "https://elazzabi.com/2020/06/29/,the-green-presence-dot/"
    }
  ]
}

total_count : Total number of blog posts we have in the database (not really)

lastUpdate : Last time we fetched RSS feeds

  • The API will return the latest 20 posts by default.
  • You can use offset and limit to fetch more
const data = await fetch(`${API}?offset=10&limit=20`);

About

A Simple API to collect Blog Posts from moroccan developers Community.


Languages

Language:JavaScript 100.0%