@dytsou/shorten-url 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,150 @@
1
+ openapi: 3.1.0
2
+ info:
3
+ title: Shorten URL Service
4
+ version: 1.0.0
5
+ description: |
6
+ A modern, fast URL shortener built with Cloudflare Workers and a responsive web interface.
7
+ - Custom slugs are supported
8
+ - The homepage is served at /home
9
+ - API is available at / (POST) for shortening URLs
10
+ - Short URL access is via /{key} (GET)
11
+ - Custom error pages for 404, security warnings, and redirects
12
+
13
+ servers:
14
+ - url: https://url.tsou.me
15
+
16
+ paths:
17
+ /shorten:
18
+ post:
19
+ summary: Shorten a URL
20
+ description: Create a new shortened URL, optionally with a custom slug.
21
+ requestBody:
22
+ required: true
23
+ content:
24
+ application/json:
25
+ schema:
26
+ type: object
27
+ required:
28
+ - url
29
+ properties:
30
+ url:
31
+ type: string
32
+ format: uri
33
+ description: The URL to shorten
34
+ example: https://www.example.com/very/long/url/path
35
+ custom_slug:
36
+ type: string
37
+ pattern: '^[a-zA-Z0-9\-_]+$'
38
+ maxLength: 50
39
+ description: Optional custom slug for the short URL
40
+ example: my-custom-link
41
+ responses:
42
+ "201":
43
+ description: URL successfully shortened
44
+ content:
45
+ application/json:
46
+ schema:
47
+ type: object
48
+ properties:
49
+ short_url:
50
+ type: string
51
+ format: uri
52
+ example: https://url.tsou.me/abc123
53
+ "400":
54
+ description: Bad request
55
+ content:
56
+ application/json:
57
+ schema:
58
+ type: object
59
+ properties:
60
+ status:
61
+ type: integer
62
+ example: 400
63
+ message:
64
+ type: string
65
+ example: Invalid URL format
66
+ "500":
67
+ description: Server error
68
+ content:
69
+ application/json:
70
+ schema:
71
+ type: object
72
+ properties:
73
+ status:
74
+ type: integer
75
+ example: 500
76
+ message:
77
+ type: string
78
+ example: Server error
79
+
80
+ /{key}:
81
+ get:
82
+ summary: Access shortened URL
83
+ description: Redirect to the original URL
84
+ parameters:
85
+ - in: path
86
+ name: key
87
+ required: true
88
+ schema:
89
+ type: string
90
+ description: The short URL key
91
+ example: abc123
92
+ responses:
93
+ "302":
94
+ description: Redirect to original URL
95
+ headers:
96
+ Location:
97
+ schema:
98
+ type: string
99
+ format: uri
100
+ "404":
101
+ description: Short URL not found
102
+ content:
103
+ text/html:
104
+ schema:
105
+ type: string
106
+
107
+ /home:
108
+ get:
109
+ summary: Get homepage
110
+ description: Serves the URL shortener frontend
111
+ responses:
112
+ "200":
113
+ description: Homepage HTML
114
+ content:
115
+ text/html:
116
+ schema:
117
+ type: string
118
+ example: URL shortener frontend with form interface
119
+
120
+ components:
121
+ schemas:
122
+ ShortenRequest:
123
+ type: object
124
+ required:
125
+ - url
126
+ properties:
127
+ url:
128
+ type: string
129
+ format: uri
130
+ description: The URL to shorten
131
+ custom_slug:
132
+ type: string
133
+ pattern: '^[a-zA-Z0-9\-_]+$'
134
+ maxLength: 50
135
+ description: Optional custom slug
136
+
137
+ ShortenResponse:
138
+ type: object
139
+ properties:
140
+ short_url:
141
+ type: string
142
+ format: uri
143
+
144
+ ErrorResponse:
145
+ type: object
146
+ properties:
147
+ status:
148
+ type: integer
149
+ message:
150
+ type: string