<feed xmlns='http://www.w3.org/2005/Atom'>
<title>water-consumption/api/internal/models, branch prod</title>
<subtitle>A simple website to track water consumption between me and my GF.</subtitle>
<link rel='alternate' type='text/html' href='https://git.zachberwaldt.dev/water-consumption/'/>
<entry>
<title>Add routes for preference, clean up and add types</title>
<updated>2024-03-15T22:49:43+00:00</updated>
<author>
<name>Zach Berwaldt</name>
<email>zberwaldt@tutamail.com</email>
</author>
<published>2024-03-15T22:49:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.zachberwaldt.dev/water-consumption/commit/?id=9cae9c1d2a0b4f7fa72f3075541b9ffafe1a7275'/>
<id>9cae9c1d2a0b4f7fa72f3075541b9ffafe1a7275</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add CORS middleware and authentication middleware to the API server.</title>
<updated>2024-03-08T00:16:07+00:00</updated>
<author>
<name>Zach Berwaldt</name>
<email>zberwaldt@tutamail.com</email>
</author>
<published>2024-03-08T00:16:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.zachberwaldt.dev/water-consumption/commit/?id=6651daca670664f3de8af9c7bcb74b1e7c6c6be9'/>
<id>6651daca670664f3de8af9c7bcb74b1e7c6c6be9</id>
<content type='text'>
The `setupRouter` function in `main.go` now includes a CORS middleware and a token authentication middleware. The CORS middleware allows cross-origin resource sharing by setting the appropriate response headers. The token authentication middleware checks for the presence of an `Authorization` header with a valid bearer token. If the token is missing or invalid, an unauthorized response is returned.

In addition to these changes, a new test file `main_test.go` has been added to test the `/api/v1/auth` route. This test suite includes two test cases: one for successful authentication and one for failed authentication.

Update go.mod to include new dependencies.

The `go.mod` file has been modified to include two new dependencies: `github.com/spf13/viper` and `github.com/stretchr/testify`.

Ignore go.sum changes.

Ignore changes in the `go.sum` file, as they only include updates to existing dependencies.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The `setupRouter` function in `main.go` now includes a CORS middleware and a token authentication middleware. The CORS middleware allows cross-origin resource sharing by setting the appropriate response headers. The token authentication middleware checks for the presence of an `Authorization` header with a valid bearer token. If the token is missing or invalid, an unauthorized response is returned.

In addition to these changes, a new test file `main_test.go` has been added to test the `/api/v1/auth` route. This test suite includes two test cases: one for successful authentication and one for failed authentication.

Update go.mod to include new dependencies.

The `go.mod` file has been modified to include two new dependencies: `github.com/spf13/viper` and `github.com/stretchr/testify`.

Ignore go.sum changes.

Ignore changes in the `go.sum` file, as they only include updates to existing dependencies.
</pre>
</div>
</content>
</entry>
</feed>
