-
Notifications
You must be signed in to change notification settings - Fork 1
API Setup
Complete all actions under title Development setup -> Dev database and migrations. You will download required development tools, create connection string and create all database tables in your postgres database server.
- Clone repository
git clone https://github.com/henrivain/Larpake.git
-
Go to folder
LarpakeServer/ -
Create file
LarpakeServer/appsettings.Development.json -
Fill file with following values
Note that your connection string ConnectionStrings.PostgreSQL might look different if you created it differently from database setup intructions.
{
"ConnectionStrings": {
"PostgreSQL": "Host=localhost; Port=5432; Database=larpake; Username=dev;Password=dev"
},
"Jwt": {
"Issuer": "https://id.larpake.luuppi.fi",
"Audience": "https://larpake.luuppi.fi",
"SecretKey": "ThisIsSecretDevelopmentKeyTheReleaseKeyShouldNotBeHere",
"RefreshTokenByteLength": 64,
"AccessTokenLifetimeMinutes": 60,
"RefreshTokenLifetimeDays": 30
}
}- Open terminal in
LarpakeServer-folder and run command
dotnet run build --launch-profile https
- View openapi page
Server launches and should open in port 7267. You can now view and make requests in openapi page https://localhost:7267/openapi.

Calling the Api requires JWT bearer token, which can be retrieved from endpoint /api/login with a user id. After getting you JWT token, you can paste you access token in the authentication field (image above). If you do not have user id yet, you can create one (for development purposes) in /api/sign-up endpoint. (Note: created user doesn't have any permissions so you must promote permissions directly in database, if you cannot figure it out, open a new issue!)
Note that this tutorial only creates one do-all connection string that is fine for development, but for production, follow instructions in Database Administration wiki
Download and install postgres: https://www.postgresql.org/download/windows/
Download and install .NET 9 sdk: https://dotnet.microsoft.com/en-us/download
Add postgres to environment PATH variables, default path is "C:\Program Files\PostgreSQL\17\bin"

i) Open postgres client in cmd:
psql -h localhost -d postgres -U postgresii) Give default password "postgres"
iii) Create user:
CREATE USER dev WITH PASSWORD 'dev';iv) Create database:
CREATE DATABASE larpake;
v) Open the database:
\c larpakevi) Give permissions to created user (do this in dev only):
GRANT ALL ON schema public TO dev;vii) Now we have following connection string (Don't run this)
Host=localhost; Port=5432; Database=larpake; Username=dev;Password=devClone git repo
git clone https://github.com/henrivain/Larpake.git
Change branch
git checkout postgres
Open MigrationsService project and create file MigrationsService\appsettings.Development.json.
Paste configuration
{
"ConnectionStrings": {
"Default": "Host=localhost; Port=5432; Database=larpake; Username=dev;Password=dev"
}
}In MigrationsService folder run
dotnet run build
Here are instructions how to generate (very) fake data to you dev database. You must have completed steps to run the database migrations that create your larpake_dev PostgreSQL database (see above).
-
Complete database initialization above
Dev database and migrations. -
Open
TestDataGenerator-project folder -
Create file
TestDataGenerator\appsettings.Development.json -
Paste application configuration to created file
{
"ConnectionStrings": {
"PostgreSQL": "Host=localhost; Port=5432; Database=larpake; Username=dev;Password=dev"
}
}- Open terminal window in the folder and run
dotnet run build
- Application runs, if everything went well, last line should read something like
Everything is now ready, press any key to close the application...- Press any button and close the window. Data should now be created.