Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.
/ readme-guestbook Public archive

A little web app that transforms a README into a guestbook.

License

Notifications You must be signed in to change notification settings

JasonEtco/readme-guestbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README Guestbook

A little web app that transforms a README into a guestbook.

Let me know that you stopped by!

How it works

When someone visits readme-guestbook.vercel.app, they're asked to login. This is so that we can sign their entry! Next, they submit a form, which hits the form handler.

Next, we call this API to fetch the contents of the README:

GET /repos/:owner/:repo/readme

Once we have the content, we parse it to look for special tags:

<!--START_SECTION:guestbook-->
...
<!--END_SECTION:guestbook-->
<!--GUESTBOOK_LIST []-->

GUESTBOOK_LIST is a JSON array of { name, message, date }. We store those objects directly in the README. When a new entry comes in, we read that existing list, add our new entry to it, then replace everything between the START_SECTION and END_SECTION tags with a freshly rendered list from a template. That brings us to calling this API to update the file contents of the README:

PUT /repos/:owner/:repo/contents/:path

Some values are hard-coded - I'm not yet sure of the best way to allow others to use this service! Feel free to open an issue if you have thoughts 🙏

About

A little web app that transforms a README into a guestbook.

Resources

License

Stars

Watchers

Forks