Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: ci

on:
pull_request:
branches: [main]

jobs:
tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26.0"

- name: Go Version
run: go test ./...
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ go build -o notely && ./notely
*This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`.

You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course!
Kulsoom's version of Boot.dev Notely app.

25 changes: 25 additions & 0 deletions README.md.save
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# learn-cicd-starter (Notely)

This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev).

## Local Development

Make sure you're on Go version 1.22+.

Create a `.env` file in the root of the project with the following contents:

```bash
PORT="8080"
```

Run the server:

```bash
go build -o notely && ./notely
```

*This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`.

You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course!

Kulsooms version of the Notely App
29 changes: 29 additions & 0 deletions internal/auth/get_api_key_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package auth

import (
"net/http"
"testing"
)

func TestGetAPIKey(t *testing.T) {
// TEST 1: The "Success" Case
// We create a header with a valid ApiKey
headers := http.Header{}
headers.Add("Authorization", "ApiKey 1234")

got, _ := GetAPIKey(headers)
want := "1234"

if got != want {
t.Errorf("expected %v, got %v", want, got)
}

// TEST 2: The "Missing Header" Case
// We create an empty header to see if it catches the error
emptyHeaders := http.Header{}
_, err := GetAPIKey(emptyHeaders)

if err == nil {
t.Errorf("expected an error but didn't get one")
}
}