You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,32 @@ Serverless URL shortener based on raw text link via cloudflare workers
4
4
5
5
This JavaScript script uses the Fetch API and the `addEventListener` function to handle a request event and redirect the user to a specific URL based on a unique ID passed in the request URL.
6
6
7
+
# How to deploy to Cloudflare and create an account
8
+
9
+
## Creating a Cloudflare account
10
+
1. Go to the Cloudflare website at https://www.cloudflare.com/.
11
+
2. Click on the "Sign Up" button in the top right corner of the page.
12
+
3. Follow the prompts to create your account.
13
+
14
+
## Deploying to Cloudflare
15
+
1. Login to your Cloudflare account.
16
+
2. Go to the "Workers" section of the Cloudflare dashboard.
17
+
3. Click on the "Create a Worker" button.
18
+
4. In the "Script" section, copy the contents of your `worker.js` file.
19
+
5. Replace the 12th line of the `worker.js` file with the URL of your hosted application. For example:
7. Test your worker by sending a request to your Cloudflare worker URL.
28
+
29
+
Congratulations! Your application is now deployed to Cloudflare.
30
+
31
+
32
+
7
33
## How it works
8
34
9
35
1. The script listens for a `fetch` event using the `addEventListener` function and calls the `handleRequest` function when the event is triggered. The request object is passed to the `handleRequest` function as an argument.
0 commit comments