...

Text file src/github.com/jackc/pgx/v5/examples/url_shortener/README.md

Documentation: github.com/jackc/pgx/v5/examples/url_shortener

     1# Description
     2
     3This is a sample REST URL shortener service implemented using pgx as the connector to a PostgreSQL data store.
     4
     5# Usage
     6
     7Create a PostgreSQL database and run structure.sql into it to create the necessary data schema.
     8
     9Configure the database connection with `DATABASE_URL` or standard PostgreSQL (`PG*`) environment variables or
    10
    11Run main.go:
    12
    13```
    14go run main.go
    15```
    16
    17## Create or Update a Shortened URL
    18
    19```
    20curl -X PUT -d 'http://www.google.com' http://localhost:8080/google
    21```
    22
    23## Get a Shortened URL
    24
    25```
    26curl http://localhost:8080/google
    27```
    28
    29## Delete a Shortened URL
    30
    31```
    32curl -X DELETE http://localhost:8080/google
    33```

View as plain text