TTime/backend
2024-02-13 08:33:35 +01:00
..
cmd Typo 2024-02-12 17:23:42 +01:00
internal/database Go server draft 2024-02-12 12:40:49 +01:00
migrations Go server draft 2024-02-12 12:40:49 +01:00
go.mod Go server draft 2024-02-12 12:40:49 +01:00
go.sum Go server draft 2024-02-12 12:40:49 +01:00
Makefile Clean target update 2024-02-12 13:11:25 +01:00
README.md Readme for backend 2024-02-13 08:33:35 +01:00

The Backend

This is the root of the backend. It contains the main server and the database logic. The structure might look confusing at first, given that go conventions (which I followed to the best of my ability) uses a rather goofy structure with the cmd and internal directories.

An important note is that go, unlike C, handles its own dependencies. A simple go get command will fetch all the dependencies for you. The go.mod file is the equivalent of a package.json file in Node.js, if you're familiar with that.

To run the backend, you can use the go run command. For example, to run the server, you can use go run cmd/main.go. This will start the server on its default port (8080, at the time of writing).

Structure

There are several moving parts to the backend. The core web server is the heart of the backend. It glues together the database and serves the routes. Some of the routes are whats called API endpoints. These are the routes that the frontend will use to communicate with the backend. The 'root' route of the web server is the one that serves the frontend. Its the route that is called when visiting 'yourwebsite.com' or 'localhost:8080' in your browser.