First, we're going to install Postgres. This will be the database that the app uses to store data. Here is the link to instructions on installing postgres. Choose the operating system of your computer.
- If you are using mac, I would suggest using homebrew.
- If homebrew is not installed, on the command line run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- Once homebrew is installed, run
brew install postgresql@14
- After postgresql@14 has been installed, start the server with
brew services start postgresql
- If homebrew is not installed, on the command line run
- If you are using windows, download the installer that matches your computer's system from here. If using Windows x86-32, version 10.23 should work for you for this project.
- Once you've installed postgres, start the postgres server
- To test that postgres was installed correctly and is running, run
createdb bvc-blog
This creates a database named bvc-blog which we will use for this application. - Then run
psql bvc-blog
to start the psql command line tool - We will create a superuser for the application to use to interact with the database. Run the following to create a user called 'postgres' with a password of 'postgres'.
CREATE ROLE postgres SUPERUSER LOGIN PASSWORD 'postgres';
- Verify that the postgres user exists with
\du
.
If you would like to use a different postgres user, you can update the appsettings.Development.json file with the username and password of the user.
You need to install dotnet 7. You can download the installer from the dotnet.microsoft page.
-
Once the download is finished, restart your terminal and go to the project's directory. We're going to traverse down one level into the MyFirstBlog directory:
cd MyFirstBlog
-
Set up an SSL certificate by running:
dotnet dev-certs https --trust
-
And finally, start the backend server:
dotnet run
You can now interact with the server through your browser. Try navigating to http://localhost:5000/swagger/index.html. This is an interface where you're able to see and interact with all the endpoints available to the app. You can use this endpoint for testing.