Skip to content

Commit 37f6e02

Browse files
committed
Update README.md
1 parent da06cda commit 37f6e02

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

README.md

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,69 @@ _This replaces the legacy [url-shortening-api-netlify-supabase](https://github.c
2727
- **Netlify Edge Functions**: Serverless functions that run at the edge, closer to your users.
2828
- **multiParser**: Parses multipart form data.
2929

30+
### **Installation**
31+
32+
To set up the project locally, follow these steps:
33+
34+
1. **Clone the Repository**:
35+
36+
```bash
37+
git clone https://github.com/samestrin/url-shortening-api-netlify-edge-supabase.git
38+
cd url-shortening-api-netlify-edge-supabase
39+
```
40+
41+
2. **Install Dependencies**: Ensure you have the required dependencies installed. Use npm or yarn to install any necessary packages.
42+
43+
```bash
44+
npm install
45+
```
46+
47+
3. **Set Up Netlify CLI**: Install the Netlify CLI to deploy and test the functions locally.
48+
49+
```bash
50+
51+
npm install -g netlify-cli
52+
```
53+
54+
4. **Run the Functions Locally**: Use the Netlify CLI to run the edge functions locally.
55+
56+
```bash
57+
netlify dev
58+
```
59+
60+
### **Configuration**
61+
62+
The `netlify.toml` file contains the configuration for the edge functions. Each function is mapped to a specific endpoint:
63+
64+
```toml
65+
[build]
66+
publish = "public"
67+
68+
[build.environment]
69+
NODE_VERSION = "20"
70+
71+
[[edge_functions]]
72+
path = "/shorten"
73+
function = "shorten"
74+
75+
[[edge_functions]]
76+
path = "/count"
77+
function = "count"
78+
79+
[[edge_functions]]
80+
path = "/latest"
81+
function = "latest"
82+
83+
[[edge_functions]]
84+
path = "/version"
85+
function = "version"
86+
87+
[[edge_functions]]
88+
path = "/*"
89+
function = "redirect"
90+
91+
```
92+
3093
## Endpoints
3194

3295
### Shorten URL

0 commit comments

Comments
 (0)