Skip to content

peterrooze/urlshortner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DATABASE_URL="postgres://postgres:mysecretpassword@localhost:5432/urlshortener?sslmode=disable" go run ./cmd/server/

#!/bin/bash

# Start PostgreSQL container if not running
docker start urlshortener-db || docker run --name urlshortener-db -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d postgres

# Ensure database exists
docker exec -it urlshortener-db psql -U postgres -c "CREATE DATABASE urlshortener" || true

# Run the application
DATABASE_URL="postgres://postgres:mysecretpassword@localhost:5432/urlshortener?sslmode=disable" go run ./cmd/server/

list db entries: docker exec -it urlshortener-db psql -U postgres -d urlshortener -c "SELECT * FROM urls;"

URL Shortener Screenshot

About

URL shortener in GO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published