Hello! Welcome to my Simple Web Backend with database experiment with ChatGPT. Feel free to clone the repo and test it out! If you want to know how I built this with ChatGPT, you can read the full blog here. This was built on top of a different experiment with ChatGPT: Repo blog
Make sure you have sqlite3 installed. You can follow along in the blog OR you can do this on a linux command line:
sudo apt update
sudo apt install sqlite3
Then, you can run it:
go run main.go
Open a new window in your terminal and try out the following commands:
$ curl http://localhost:8080/people
[]
$ curl -X POST -H "Content-Type: application/json" -d '{"name":"Jane","age":30}' http://localhost:8080/people
$
$ curl http://localhost:8080/people
[{"ID":1,"CreatedAt":"2023-04-15T12:18:41.1606938-06:00","UpdatedAt":"2023-04-15T12:18:41.1606938-06:00","DeletedAt":null,"name":"Jane","age":30}]
curl http://localhost:8080/people?name=Jane
[{"ID":1,"CreatedAt":"2023-04-15T12:18:41.1606938-06:00","UpdatedAt":"2023-04-15T12:18:41.1606938-06:00","DeletedAt":null,"name":"Jane","age":30}]
$ curl -X DELETE http://localhost:8080/people/Jane
$
$ curl http://localhost:8080/people
[]