pgx/examples/url_shortener
Jack Christensen 9a1ab885af Use insert on conflict for url shortener example
fixes #290
2017-07-14 08:57:25 -05:00
..
README.md Added example url shortener 2013-08-05 13:08:45 -05:00
main.go Use insert on conflict for url shortener example 2017-07-14 08:57:25 -05: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.

Edit connectionOptions in main.go with the location and credentials for your database.

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