Files
Backend-Barracuda/README.md

54 lines
1.5 KiB
Markdown

# SDG-Backend-Barracuda
This is an ASP.NET Core Web API with a PostgreSQL backend, using Dapper for high-performance data access.
## Prerequisites
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
- [PostgreSQL](https://www.postgresql.org/download/)
## PostgreSQL Database Setup
Follow these steps to set up your local PostgreSQL database:
### 1. Create Database and User
If you haven't already, create a database and a user with appropriate permissions. You can use `psql` or a tool like pgAdmin.
```sql
-- Create SDG-Backend-Admin
CREATE USER "SDG-Backend-Admin" WITH ENCRYPTED PASSWORD 'password';
-- Create the database
CREATE DATABASE "SDG-Backend" OWNER "SDG-Backend-Admin";
```
### 2. Configure Connection String
#### Initialize User Secrets
Run this in the project directory (`SDG-Backend-Barracuda\SDG-Backend-Barracuda`):
```bash
dotnet user-secrets init
```
#### Set the Connection String
Replace `password` if you used a different one during setup:
```bash
dotnet user-secrets set "ConnectionStrings:DefaultConnection" "Host=localhost;Database=SDG-Backend;Username=SDG-Backend-Admin;Password=password;Maximum Pool Size=100;"
```
## Development
### Installing Dependencies
The project uses `Npgsql`, `Dapper`, and `Npgsql.DependencyInjection`.
```bash
dotnet add package Npgsql
dotnet add package Dapper
dotnet add package Npgsql.DependencyInjection
```
### Running the Application
From the root directory:
```bash
dotnet run --project SDG-Backend-Barracuda
```