Skip to content

An API for creating Meetups about Tech or other topics

License

Notifications You must be signed in to change notification settings

Coryf65/Meet.API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Meet.API

A Web based API for conducting Meetups

ℹ️🚩 Built for Software Developers, as a demo and practice for me. 🚩ℹ️

Tools

  • C#
  • .NET 6
  • EntityFramework
  • NLog

Running From Visual Studio / VS Code

This is not intended for production (end users), it is meant as demo or example of creating a RESTful Web API in C# and .NET.

in order to run this project do the following ...

  1. Set the JWT Key Info on JWT to something either in appsettings.json OR UserSecrets docs "JwtKey": "SET_THIS_TO_SOMETHING_DONT_SHARE"

⚠️ If you get an error like 'IDX10653: The encryption algorithm 'http://www.w3.org/2001/04/xmldsig-more#hmac-sha256' requires a key size of at least '128' bits. Key '[PII of type 'Microsoft.IdentityModel.Tokens.SymmetricSecurityKey' is hidden. For more details, see https://aka.ms/IdentityModel/PII.]', is of size: '8'. (Parameter 'key')'' your JWT Key may need to be longer in length ⚠️

  1. you would need to run in Visual Studio Package Manager : add-migration MigrationName or Run dotnet ef migrations add MigrationName
  2. You should now be able to build and run 👍

Screenshot 2023-02-05 at 16-53-12 Swagger UI postman_screencap

Entity Framework Migrations Commands and Info

More Info ...

Commands for DB Migrations

The Microsoft Docs

  1. Create a Migration

At the very first time, you defined the initial domain classes. At this point, there is no database for your application which can store the data from your domain classes. So, firstly, you need to create a migration

using the Package Manager Console in Visual Studio

PM> add-migration MigrationName

using the CLI (any terminal / command line) and dotnet

> dotnet ef migrations add MigrationName

You may need to add the following packge if you get this error:

Screenshot from 2023-04-05 12-15-47

from the PM console in Viusal Studio

PM> Install-Package Microsoft.EntityFrameworkCore.Tools

from dotnet cli

dotnet tool install -g dotnet-ef
  1. Creating or Updating the Database

PM> Update-Database 
> dotnet ef database update 
  1. Removing a Migration

PM> remove-migration
> dotnet ef migrations remove
  1. Reverting a Migration

PM> Update-database MigrationName 
> dotnet ef database update MigrationName
  1. Generating a SQL Script

Use the following command to generate a SQL script for the database.

PM> script-migration
> dotnet ef migrations script

About

An API for creating Meetups about Tech or other topics

Topics

Resources

License

Stars

Watchers

Forks

Languages