Initial commit

Daniel Tanaka 1 year ago
commit 64de83d3857f82e23ef8543de75340608f34a000
4 changed files with 62 additions and 0 deletions
+3-0.gitignore ADDED
@@ -0,0 +1,3 @@
1+bin/
2+*.exe
3+.env
+21-0LICENSE ADDED
@@ -0,0 +1,21 @@
1+MIT License
2+
3+Copyright (c) 2025 glibCode
4+
5+Permission is hereby granted, free of charge, to any person obtaining a copy
6+of this software and associated documentation files (the "Software"), to deal
7+in the Software without restriction, including without limitation the rights
8+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+copies of the Software, and to permit persons to whom the Software is
10+furnished to do so, subject to the following conditions:
11+
12+The above copyright notice and this permission notice shall be included in all
13+copies or substantial portions of the Software.
14+
15+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+SOFTWARE.
+33-0README.md ADDED
@@ -0,0 +1,33 @@
1+# Build APIs with Go
2+
3+Example code and exercises for the glibCode course **[Build APIs with Go](https://glibcode.net/courses/go-apis/)** (Intermediate, about 10 hours).
4+
5+HTTP handlers, JSON, middleware and tests with nothing but the standard library. Then Postgres and deployment.
6+
7+## Lessons
8+
9+| # | Lesson | Code |
10+| --- | --- | --- |
11+| 1 | Go in one afternoon | [`lessons/01-go-in-one-afternoon`](lessons/01-go-in-one-afternoon/) |
12+| 2 | Your first HTTP server | [`lessons/02-your-first-http-server`](lessons/02-your-first-http-server/) |
13+| 3 | JSON in and out | [`lessons/03-json-in-and-out`](lessons/03-json-in-and-out/) |
14+| 4 | Routing and middleware | [`lessons/04-routing-and-middleware`](lessons/04-routing-and-middleware/) |
15+| 5 | Talking to Postgres | [`lessons/05-talking-to-postgres`](lessons/05-talking-to-postgres/) |
16+| 6 | Testing handlers | [`lessons/06-testing-handlers`](lessons/06-testing-handlers/) |
17+| 7 | Context and timeouts | [`lessons/07-context-and-timeouts`](lessons/07-context-and-timeouts/) |
18+| 8 | Project: a URL shortener | [`lessons/08-project-a-url-shortener`](lessons/08-project-a-url-shortener/) |
19+
20+## Getting started
21+
22+```sh
23+git clone https://git.glibcode.net/glibcode/go-apis.git
24+cd go-apis
25+```
26+
27+Go 1.22 or newer (the routing lessons use the method patterns of `net/http`).
28+
29+Questions? Ask in the course forum or write to help@glibcode.net.
30+
31+## License
32+
33+The code is MIT licensed (see `LICENSE`). The lesson texts are © glibCode.
+5-0go.mod ADDED
@@ -0,0 +1,5 @@
1+module git.glibcode.net/glibcode/go-apis
2+
3+go 1.22
4+
5+require github.com/jackc/pgx/v5 v5.7.1