This repo contains only the C#/.Net back-end API of a single page application for collecting, storing, and visualizing user-support interactions for various portals. Full functionality requires that you also clone the React front-end from https://github.com/brandonfullstack/metrics-app
- C#
- .NET.
- Entity Framework Core
- MySQL
- Git
Note: An installation of the .NET SDK is required in order to run this application locally. See Here for installation.
Please install Entity Framework Core by running the following command in your terminal:
$ dotnet tool install --global dotnet-ef --version 6.0.0
Additionally, please install the following for versioning functionality:
$ dotnet add package Microsoft.AspNetCore.Mvc.Versioning
$ dotnet add package Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer
- Copy project directory or clone repo from Github (https://github.com/brandonfullstack/MetricsApi.Solution) to your desktop.
- Open your terminal (e.g., Terminal or GitBash) and navigate to this project's production directory called "MetricsApi".
- Create a file named
appsettings.json:$ touch appsettings.json - Within
appsettings.jsonadd the following code, replacing theuidandpwdvalues with your own username and password for MySQL. Replace the database value with the name that you wish to give the database that will back up this application. Entity will create thedatabasefor you in a subsequent step.
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Server=localhost;Port=3306;database=metrics_api;uid=root;pwd=epicodus;"
}
}- Within
appsettings.Development.jsonadd the following code:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Trace",
"Microsoft.AspNetCore": "Information",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}- Run
$ dotnet ef database update. This command will create the database and required tables on your local machine. - Navigate to the project directory:
$ cd MetricsApi - In the command line, run the command
$ dotnet runto compile and execute the web API. - Open your browser and navigate to
http://localhost:5000/swaggerif it doesn't open for you automatically.
- No known issues
- Please visit this projects GitHub repository to submit Issues and Pull Requests.
Copyright (c) 2023 Brandon Wright