Skip to content

🟠 Deployed a Cloudflare Workers projects that builds link tree style website 🌲

Notifications You must be signed in to change notification settings

aditiabhang/my-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

Cloudflare Project

Deployed a Cloudflare Workers project that builds a linktree-style website.

Deployed a JSON API

As a first step, I created a new Workers project using Wrangler. It responds to two kinds of requests, one to generate a JSON API, and second, to serve an HTML page

To begin, I defined an array of links in Javascript with number of link objects, each with a name and URL string. Like below example for one of these link objects:

{ "name": "Portfolio", "url": "http:https://aditiabhang.github.io/" }

I have defined a few links in this array. (Go visit my final project and check em out..!!

Once I defined this array, I set up a request handler to respond to the path /links, which returns the array itself as the root of the JSON response.

In addition, I also ensured that the API response has the correct Content-Type header to indicate to clients that it is a JSON response.

Screenshots:

LinkTree Style Website

Screen Shot 2020-10-28 at 3 55 58 PM

Request Handler JSON Response

Screen Shot 2020-10-28 at 3 56 25 PM