Skip to content

This is my team project build Apple Store using C-Sharp Dotnet Core

Notifications You must be signed in to change notification settings

Bacdong/applestore-v3-api

Repository files navigation

Apple Store

Reference Documentation

Setup Development Enviroments (Linux)

sudo apt install nodejs
sudo apt install npm
  • PostgreSQL Installation:
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql
  • DBeaver - Database Management Tools Installation:
wget -O - https://dbeaver.io/debs/dbeaver.gpg.key | sudo apt-key add -
echo "deb https://dbeaver.io/debs/dbeaver-ce /" | sudo tee /etc/apt/sources.list.d/dbeaver.list
sudo apt-get update && sudo apt-get install dbeaver-ce

ASP.NET Core Update Latest Version

chmod +x ./dotnet-install.sh
./dotnet-install.sh -c Current
./dotnet-install.sh -c Current --runtime aspnetcore
./dotnet-install.sh -c 5.0

ASP.NET Core Update Latest Version

chmod +x ./dotnet-install.sh
./dotnet-install.sh -c Current
./dotnet-install.sh -c Current --runtime aspnetcore
./dotnet-install.sh -c 5.0

Package Installation

cd applestore_dotnet_core
  • Entity Framework:
dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet add package Microsoft.EntityFrameworkCore.Tools
dotnet add package Microsoft.Extensions.Configuration.FileExtensions
dotnet add package Microsoft.Extensions.Configuration.Json
dotnet add package Microsoft.AspNetCore.Identity.EntityFrameworkCore
dotnet add package Microsoft.AspNetCore.Hosting
dotnet add package Microsoft.AspNetCore.Http
dotnet add package Swashbuckle.AspNetCore
  • EF Core Tools: Installation
dotnet tool install --global dotnet-ef
  • EF Core Tools: Update
dotnet tool update --global dotnet-ef
  • Troubleshoot .NET Core tool: dotnet-ef does not exist
export PATH=$HOME/.dotnet/tools:$PATH"

Migrations Database

  • Adding a migration:
dotnet ef migrations add <migration_name> -o "Data/Migrations"
  • Update database:
dotnet ef database update
  • Remove migration:
dotnet ef migrations remove

Push a commit code to source code management

git add .
git commit -m "<commit_message>"
git push -u origin master (push to Github)
git push -u Main master (push to Gitlab)

Setup The Trust HTTPs Certificate for Linux

cd OpenSSL
sudo apt install libnss3-tools
pk12util -d sql:$HOME/.pki/nssdb -i localhost.pfx
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n 'dev cert' -i localhost.crt
  • Creating a basic certificate using OpenSSL
openssl req -new -x509 -newkey rsa:2048 -keyout localhost.key -out localhost.cer -days 365 -subj /CN=localhost
openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.cer
openssl req -config localhost.conf -new -x509 -sha256 -newkey rsa:2048 -nodes \
    -keyout localhost.key -days 3650 -out localhost.crt
openssl pkcs12 -export -out localhost.pfx -inkey localhost.key -in localhost.crt

Project Start

dotnet watch run

Template

Participants