🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

github.com/vancanhuit/url-shortener-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/vancanhuit/url-shortener-api

v0.0.0-20250211142349-d96961d012e2
Source
Go
Version published
Created
Source

Simple URL Shortener

CI

Install the following tools:

Running test: go test -v -cover ./...

Running API locally:

$ docker compose up -d --build
# NOTE: The generated alias will be different in every run
$ curl -X POST \
        -H "Content-Type: application/json" \
        http://localhost:9000/api/shorten -d '{"url": "https://reddit.com"}'
HTTP/1.1 201 Created
Content-Type: application/json
Date: Tue, 08 Aug 2023 12:54:54 GMT
Content-Length: 69

{"data":{"original_url":"https://reddit.com","alias":"sPQAW_f7HdB"}}

$ curl -i http://localhost:9000/sPQAW_f7HdB
HTTP/1.1 302 Found
Content-Type: text/html; charset=utf-8
Location: https://reddit.com
Date: Tue, 08 Aug 2023 12:55:19 GMT
Content-Length: 41

<a href="https://reddit.com">Found</a>.

$ curl -i -X DELETE http://localhost:9000/sPQAW_f7HdB
HTTP/1.1 204 No Content
Date: Tue, 08 Aug 2023 12:55:49 GMT

FAQs

Package last updated on 11 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts