A full e-commerce api built in "Construindo um ecommerce com .NET + Azure 2023" course by Lucas Eschechola!
You can contact me here!
Or send an email to lucas.eschechola@outlook.com
- Clone the repository
$ git clone https://github.com/Eschechola/StorEsc.git $ cd StorEsc $ dotnet clean $ dotnet restore
-
Create custom database image OR use compose
$ cd environment/database $ docker build -t sqlserver_storesc . $ docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=<YOUR_PASSWORD>" -p 1433:1433 -d sqlserver_storesc
$ docker-compose up --build
-
Add environment variables
3.1 SQL Server$ dotnet user-secrets set "Databases:ConnectionStrings:SqlServer" "Server=127.0.0.1;User Id=sa;Password=<YOUR_PASSWORD>;Database=StorEsc;TrustServerCertificate=True" --project src/StorEsc.Api/StorEsc.Api.csproj
3.2 JWT (8 characters)$ dotnet user-secrets set "Token:SecretKey" "<YOUR_SECRET_KEY>" --project src/StorEsc.Api/StorEsc.Api.csproj
3.3 Argon2Id Salt (16 characters)$ dotnet user-secrets set "Hash:Argon2Id:Salt" "<YOUR_SALT>" --project src/StorEsc.Api/StorEsc.Api.csproj
- Run migrations to create database
$ dotnet ef database update --connection "Server=127.0.0.1;User Id=sa;Password=<YOUR_PASSWORD>;Database=StorEsc;TrustServerCertificate=True" --context StorEscContext --project src/StorEsc.Infrastructure/StorEsc.Infrastructure.csproj
- Run the project!
$ dotnet run
- Util Commands - Create Local Migration
$ dotnet ef migrations add InitialMigration --project src/StorEsc.Infrastructure/StorEsc.Infrastructure.csproj
- Util Commands - Apply Local Migration
$ dotnet ef database update --connection "Server=127.0.0.1;Database=StorEsc;User Id=<YOUR_USER>;Password=<YOUR_PASSWORD>;TrustServerCertificate=True" --context StorEscContext --project src/StorEsc.Infrastructure/StorEsc.Infrastructure.csproj
2023