https://github.com/prashantrahul141/blogwebapidotnet
Web Apis for a simple blogging app using ASP .NET 8
https://github.com/prashantrahul141/blogwebapidotnet
asp-net csharp dotnet
Last synced: 2 months ago
JSON representation
Web Apis for a simple blogging app using ASP .NET 8
- Host: GitHub
- URL: https://github.com/prashantrahul141/blogwebapidotnet
- Owner: prashantrahul141
- License: mit
- Created: 2024-05-08T05:42:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-05T16:53:38.000Z (about 2 years ago)
- Last Synced: 2025-01-22T02:23:47.584Z (over 1 year ago)
- Topics: asp-net, csharp, dotnet
- Language: C#
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Web Apis for a simple blogging app using ASP .NET 8
Web Apis for a simple blogging app using ASP .NET 8, The frontend I made for this can be found here:
**https://github.com/prashantrahul141/dotnet-t3-blogs**
This project uses the following packages.
- BCrypt.Net-Next
- Microsoft.AspNetCore.Identity.EntityFrameworkCore
- Microsoft.EntityFrameworkCore
- Microsoft.EntityFrameworkCore.Design
- Npgsql.EntityFrameworkCore.PostgreSQL
- Swashbuckle.AspNetCore
- Swashbuckle.AspNetCore.Filters
### Building
Make sure you .NET 8 installed, [Installation instructions](https://learn.microsoft.com/en-us/dotnet/core/install/)
You can also make sure it's installed by running dotnet
```sh
$ dotnet
```
Add the following environment variables to `.env` file, this will get checked at runtime before starting the application using [LoadEnv.cs](https://github.com/prashantrahul141/BlogWebApiDotNet/blob/main/Utils/LoadEnv.cs)
```env
# DB using Postgres.
PG_PASSWORD=password of postgres instance
PG_HOST=hostname of db instance
PG_DATABASE=database name
PG_USERNAME=username of db instance
PG_PORT=port of db instance
# JWT Token for Auth.
JWT_ISSUER=http://localhost:3000
JWT_AUD=http://localhost:3000
# Can be created at https://generate-secret.vercel.app/64
JWT_KEY=
```
Run build
```sh
$ dotnet build
```
Migrate database, for this you will need to install EF, [Install instructions](https://learn.microsoft.com/en-us/ef/core/cli/dotnet)
```sh
$ dotnet ef migrations add InitialMigration
```
Then update
```sh
$ dotnet ef database update
```
Then finnaly run the application
```sh
$ dotnet run
```
Swagger UI should automatically open in your default browser at http://localhost:5248/swagger/index.html