const router = new require('express').Router();
const { fetchLatestMediumPosts } = require('./index');

router.get('/', (req, res) => {
    fetchLatestMediumPosts().then((posts) => {
        const latestPost = posts[0];
        const response = {
            title: latestPost.title,
            url: `https://blog.arnellebalane.com/${latestPost.uniqueSlug}`,
            date: new Date(latestPost.createdAt)
        };
        res.json(response);
    });
});

module.exports = router;

@@ -41,16 +41,56 @@
 uter();%0A
+const %7B format %7D = require('date-fns');%0A
 const %7B 
@@ -411,16 +411,23 @@
   date: 
+format(
 new Date
@@ -442,17 +442,41 @@
 ost.
-createdAt
+firstPublishedAt), 'MMMM D, YYYY'
 )%0A  

format medium post date