https://github.com/xiaomengxinx/url-shortener
A serverless short url api on vercel powered by golang
https://github.com/xiaomengxinx/url-shortener
go golang hacktoberfest url-shortener vercel
Last synced: 9 months ago
JSON representation
A serverless short url api on vercel powered by golang
- Host: GitHub
- URL: https://github.com/xiaomengxinx/url-shortener
- Owner: XiaoMengXinX
- License: gpl-3.0
- Created: 2022-02-23T17:02:04.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-12-01T10:57:27.000Z (over 1 year ago)
- Last Synced: 2025-10-06T17:02:40.570Z (9 months ago)
- Topics: go, golang, hacktoberfest, url-shortener, vercel
- Language: HTML
- Homepage: https://xve.me
- Size: 34.2 KB
- Stars: 11
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# url-shortener
A serverless short url api on vercel, powered by golang.
### API Calling Reference
```go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
func main() {
resp, _ := http.PostForm("https://[YOUR_DEPLOYMENT_URL]/api/url",
url.Values{
"url": {"https://www.baidu.com/"}, // The url to be shortened
"token": {"baidu"}, // Custom shorten url token (optional)
})
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
```
Response:
```json
{
"token": "baidu",
"error": ""
}
```