pgx/examples/url_shortener
Jack Christensen b2569172d8 Fix typo in example 2021-12-11 14:55:02 -06:00
..
README.md Update url_shortener example 2019-05-17 14:13:03 -05:00
main.go Fix typo in example 2021-12-11 14:55:02 -06:00
structure.sql Added example url shortener 2013-08-05 13:08:45 -05:00

README.md

Description

This is a sample REST URL shortener service implemented using pgx as the connector to a PostgreSQL data store.

Usage

Create a PostgreSQL database and run structure.sql into it to create the necessary data schema.

Configure the database connection with DATABASE_URL or standard PostgreSQL (PG*) environment variables or

Run main.go:

go run main.go

Create or Update a Shortened URL

curl -X PUT -d 'http://www.google.com' http://localhost:8080/google

Get a Shortened URL

curl http://localhost:8080/google

Delete a Shortened URL

curl -X DELETE http://localhost:8080/google