This website was made using Angular 14 and ASP.NET 6
The big idea behind the website is that the admin has close to complete control of the text, images, and partly the layout
Visit the website at https://salonmlsarajevo.com/admin-test and click around to emulate being the admin. Using the preceding link sets an invalid token in local storage - allowing you to pretend to be an admin on the front end, but not allowing any changes to occur in the backend (you will receive expected 401 responses)
Be sure to check the "Tips and Tricks" in the footer for more information
This was the first website I've made and deployed, and the first time using Angular. Credit to utilizing angular goes to author of this book - I read the book before starting this project
In addition, this template(s) was purchased and built upon
- Angular 14
- ASP.NET 6
- Entity Framework
- SQL Server Express
- SQL Server Management Studio
- Nginx
- In order to get npm we have to install NodeJS from this link (choose LTS)
- Run the command
npm install -g @angular/cli@14
- Download Git here
- Open Windows PowerShell or Command Prompt and run the following commands:
- Run
cd C:\
- Run
mkdir Projects
- Run
cd Projects
- To download the code run
git clone https://github.com/dzenis-zigo/Frizerski-Salon-ML.git
- Run
cd Frizerski-Salon-ML\SalonML\SalonML
- To install libraries run
npm install
- Leave the shell window open for upcoming commands
- Download from this link (make sure you choose SDK not Runtime)
- Download the Community version here
- Choose "ASP.NET and web development" and "Azure development" at the install screen
- When install is finished, open the Solution file at the following directory:
C:\Projects\Frizerski-Salon-ML\SalonML
- Right click the solution in the Solution Explorer window and select "Set Startup Projects"
- Under "Single startup project", select SalonML_API
- Right click on the SalonML_API project and select "Manage User Secrets"
- Copy paste the following code (wait until the next step to insert the SQL Server Connection String):
{
"ConnectionStrings": {
"DefaultConnection": "<SQL Server Connection String>"
},
"DefaultUsers": {
"DefaultEmailOne": "<Valid email>"
"DefaultPassword": "<Password with 8 characters: 1 lowercase, 1 uppercase, 1 digit, and 1 special character>"
},
"JwtSettings": {
"SecurityKey": "<String with at least 16 characters>"
},
"SendInBlue": {
"APIKey": "<Get an Email API Key online at sendinblue.com (optional if you don't plan to use reset password or contact form features)>"
}
}
- Make sure you replace DefaultUsers:DefaultEmailOne and DefaultUsers:DefaultPassword with valid values or else you will get errors in a future step
- Download the Express edition here
- When finished copy the Connection String into the previous step's secrets.json ConnectionStrings:DefaultConnection field
- If you have trouble with the string, it should look something like this:
Server=localhost\\SQLEXPRESS01;Database=<DB Name>;Trusted_Connection=True;
- Make sure to replace
<DB Name>
withsalon-ml
(it should by default bemaster
)
- If you have trouble with the string, it should look something like this:
- Click the Install SSMS and then download SQL Server Management Studio 18.12.1
- Download here
- Connect to the database using the default values
- Install the dotnet-ef CLI tool by executing this command in PowerShell or CMD:
dotnet tool install --global dotnet-ef
- Navigate to
C:\Projects\Frizerski-Salon-ML\SalonML\SalonML_API
and execute the commanddotnet ef database update
- View the results in SSMS (the relevant tables will show up under
Databases
>System Databases
>salon-ml
>Tables
)- There will be six tables created by ASP.NET Identity and one table created code-first by us (dbo.DynamicContents) - we will populate these tables in the next steps
- To start the Angular frontend make sure you are in the
C:\Projects\Frizerski-Salon-ML\SalonML\SalonML
directory in PowerShell or CMD - Run
ng serve
- When finished, navigate to localhost:4200 in a web browser
- Run the ASP.NET backend by clicking the green arrow and "SalonML_API"
- Trust any self-signed SSL certs
- In the swagger window that comes up, first run
GET /api/Seed/CreateDefaultUsers
(Try it out > Execute)- Observe the results in SSMS under the
dbo.AspNetUsers
table (right click the table and select Select Top 1000 Rows)
- Observe the results in SSMS under the
- Navigate to
http://localhost:4200/
in a browser and click Login at the bottom of the page - After logging in with the values that you set in secrets.json, click Seed Data at the bottom of the page
- Observe the results in the
dbo.DynamicContents
table
- Observe the results in the