This is a personal project for personal note taking written with a golang backend
make config_file_path=local.config.yaml run
Username: admin
Pasword:: admin
The backend requires configuration in a yaml file and its path is to be provided as an argument during start up. The configuration file follows the following structure:
includeSwagger: true #Enable swagger for endpoints
port: 8888 #Port for server
jwtSecret: SomeSecret #Secret for generating JWT
db:
driver: sqlite3 #Database driver
path: ./local.db #Location of sqlite3 database
For better developer experience, documenation is provided by an embedded swagger-ui
server. The required swagger.json
file is generated by running the make
command above. For this, the swag package is required to be installed. The swagger-ui
is enabled by default, but can be disabled with the includeSwagger
flag in the configuration file.
The swagger-ui
is accessable by following http:https://localhost:8888/swagger/index.html
Database migrations are automaticly run after the server starts up. To create migrations, the goose package is required. To install the package, run:
go install github.com/pressly/goose/v3/cmd/goose@latest
After goose
is installed, migrations can be created. To create one, navigate to the backend
directory and execute the following command:
goose --dir ./migrations sqlite3 ./local.db create <migrations_name> sql
Migrations can be applied by running:
goose --dir ./migrations sqlite3 ./local.db up
Tearing down database migrations can be done by applying:
goose --dir ./migrations sqlite3 ./local.db down