Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
github.com/zy-131/url-shortener-api
URL Shortening API in GoLang
Follow these instructions to download and run the project on your local machine
Clone the repository:
Navigate to your project directory
Run the following command in your terminal:
git clone https://github.com/zy-131/url-shortener-api.git
cd url-shortener-api
Initialize the Go module:
go mod init <module-name>
Install dependencies:
go mod tidy
Navigate to your local project's root directory
Run the following command to start your local server:
go run ./src/
With the server running, open a new terminal or Postman and send a POST
request with the URL that you want to shorten
Note: A GET
request without an inital succesful POST
request will result in a 404 StatusNotFound
error
Example (Powershell cURL):
curl http://localhost:8080/shortenURL -METHOD POST -BODY '{"long_url": "<original-url>"}'
Open the shortened URL in a browser
Ex: localhost:8080/abc123
POST /shortenURL
Content-Type: application/json
{
"long_url": "https://www.example.com"
}
The long_url
field is required and will return a 400 StatusBadRequest
error if missing
Status Code:
201 Created
if successfulResponse Body:
"abc123"
404 StatusBadRequest
{
"message": "No URL passed in"
}
GET /:shortenURL
shortURL
: The shortened URL identifier (ex: abc123
from http://localhost:8080/abc123
)302 Found
if shortened URL exists
Location
header will contain original URL and cliented will be redirected
404 StatusNotFound
if the shortened URL does not exist{
"message": "Short URL not found"
}
In progress ...
FAQs
Unknown package
Did you know?
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.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.