File: README.md

package info (click to toggle)
golang-github-jackc-pgx 4.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 796 kB
  • sloc: sh: 44; sql: 8; makefile: 7
file content (33 lines) | stat: -rw-r--r-- 642 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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
```