Coder Social home page Coder Social logo

mtsafe.solution's Introduction

MtSafe.Solution

Project Initiated: 2021-01-19
Updated: 2021-01-19

MtSafe Description

This project was created as a crowd source weather saftey application to allow for users to report weather conditions in specific areas.

As a user I, want to get and post reports about user experienced conditions.
As a user I, want to know where this specific report is referenced to. As a user I, want to limit PUT and DELETE actions to the Report Creator. As a user I, want reports to be queryable by date, location, inputting user.

Required for Use

  • C# and .Net Core installed on your local machine. (Developed on .Net Core v2.2.4)
  • Console/Terminal access.
  • Code Editor like Visual Studio Code
  • MySQL Community Server
  • MySQL Workbench

Installation Instructions

Download .Net Core and follow the installation instructions for your computer's operating system.

Installing C#, .NET

Install C# and .Net according to your operating system below:

For Mac

  1. Download this .NET Core SDK Software Development Kit.
  2. Open the .pkg file. This will launch an installer which will walk you through installation steps. Use the default settings the installer suggests.
  3. Confirm the installation is successful by opening your terminal and running the command dotnet --version, which should return the correct version number.

For Windows (10+)

  1. Download either the the 64-bit .NET Core SDK Software Development Kit
  2. Open the file and follow the steps provided by the installer for your OS.
  3. Confirm the installation is successful by opening a new Windows PowerShell window and running the command dotnet --version You should see a response with the correct version number.

My SQL Installation Below

Windows 10 -

Start by downloading the MySQL Web Installer from the MySQL Downloads page. (Use the No thanks, just start my download link.)

Follow along with the installer:

  1. Click "Yes" if prompted to update.
  2. Accept license terms.
  3. Choose Custom setup type.
  4. When prompted to Select Products and Features, choose the following:
  • MySQL Server 8.0.19 (This will be under "MySQL Servers > MySQL Server > MySQL Server 8.0")

  • MySQL Workbench 8.0.19 (This will be under "Applications > MySQL Workbench > MySQL Workbench 8.0")

  1. Select "Next", then "Execute". Wait for download and installation. (This can take a few minutes.)

  2. Advance through Configuration as follows:

  • High Availability set to "Standalone".

  • "Defaults are OK" under Type and Networking.

  • Authentication Method set to Use Legacy Authentication Method.

  • Set password to something you will remember.

  • Defaults are OK under Windows Service. Make sure that checkboxes are checked for the options "Configure MySQL Server as a Windows Service" and "Start the MySQL Server at System Startup". Under Run Windows Service as..., the "Standard System Account" should be selected.

  1. Complete Installation process. Next, add the MySQL environment variable to the System PATH. We must include MySQL in the System Environment Path Variable. This is its own multi-step process:

  2. Open the Control Panel and visit System and "Security > System". Select "Change Settings" and a pop-up window will display. Select the tab "Advanced" and select the "Environment Variables" button.

  3. Within the System Variables navigator window, select PATH..., click Edit..., and then New.

  4. Add the exact location of your MySQL installation, and click OK. (This location is likely C:\Program Files\MySQL\MySQL Server 8.0\bin, but may differ depending on your specific installation.)

MacOS -

Start by downloading the MySQL Community Server .dmg file from the MySQL Community Server page. Click the download icon. Use the No thanks, just start my download link.

Next, follow along with the Installer until you reach the Configuration page. Once you've reached Configuration, select or set the following options (use default if not specified):

  1. Use Legacy Password Encryption.

  2. Set password to something you will remember.

  3. Click Finish.

  4. Open the terminal and enter the command echo 'export PATH="/usr/local/mysql/bin:$PATH"' >> ~/.bash_profile. This will save this path in .bash_profile, which is where our terminal is configured.

  5. Type in source ~/.bash_profile (or restart the terminal) in order to actually verify that MySQL was installed.

Next, verify MySQL installation by opening terminal and entering the command mysql -uroot -pepicodus. You'll know it's working and connected if you gain access and see the MySQL command line. If it's not working, you'll likely get a -bash: mysql: command not found error.

You can exit the mysql program by entering exit.

Next, download the MySQL Workbench .dmg file from the MySQL Workbench page. (Use the No thanks, just start my download link.)

Install MySQL Workbench to Applications folder.

Then open MySQL Workbench and select the Local instance 3306 server. You will need to enter the password you set. (We used epicodus.) If it connects, you're all set.

Setup and Use

Cloning

  1. Navigate to the Mt.Safe API Repository.
  2. Click 'Clone or download' to reveal the HTTPS url ending with .git and the 'Download ZIP' option.
  3. Open up your system Terminal or GitBash, navigate to your desktop with the command: cd Desktop, or whichever location suits you best.
  4. Clone the repository to your desktop: $ git clone https://github.com/MaxBrockbank/MtSafe.Solution.git
  5. Run the command cd MtSafe.Solution to enter into the project directory.
  6. View or Edit:
    • Code Editor - Run the command atom . or code . to open the project in Atom or VisualStudio Code respectively for review and editing.
    • Text Editor - Open by double clicking on any of the files to open in a text editor.

Download

  1. Navigate to the Mt.Safe API Repository.
  2. Click 'Clone or download' to reveal the HTTPS url ending with .git and the 'Download ZIP' option.
  3. Click 'Download ZIP' and unextract.
  4. Open by double clicking on any of the files to open in a text editor.

AppSettings

  1. Create a new file in the CoffeeTrackerAPI.Solution/CoffeeTrackerAPI directory named appsettings.json
  2. Add in the following code snippet to the new appsettings.json file:
{
  "Logging": {
      "LogLevel": {
      "Default": "Warning"
      }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": {
      "DefaultConnection": "Server=localhost;Port=3306;database=mt_safe;uid=root;pwd=YourPassword;"
  }
}
  1. Change the server, port, and user id as necessary. Replace 'YourPassword' with relevant MySQL password (set at installation of MySQL).

Database

  1. Navigate to MtSafe.Solution/MtSafe directory using the MacOS Terminal or Windows Powershell (e.g. cd Desktop/MtSafeAPI.Solution/MtSafe).
  2. Run the command dotnet ef database update to generate the database through Entity Framework Core.
  3. (Optional) To update the database with any changes to the code, run the command dotnet ef migrations add <MigrationsName> which will use Entity Framework Core's code-first principle to generate a database update. After, run the previous command dotnet ef database update to update the database.

Launch the API

  1. Navigate to MtSafe.Solution/MtSafe directory using the MacOS Terminal or Windows Powershell (e.g. cd Desktop/MtSafe.Solution/MtSafe).
  2. Run the command dotnet run to have access to the API in Postman or browser.
  3. SIDENOTE: If changes are made to the Controller file you will need to run the dotnet build command before you can run dotnet run to see your changes active.

API Documentation

Explore the API endpoints in Postman or a browser. You will not be able to utilize authentication in a browser.

Using Swagger Documentation

To explore the CoffeeTracker API with NSwag, launch the project using dotnet run with the Terminal or Powershell, and input the following URL into your browser: http://localhost:5000/swagger

Example Query

http://localhost:5000/api/2.0/reports?username=Albert

..........................................................................................

Endpoints

Base URL: https://localhost:5000

Reports

Access user created snow reports.

HTTP Request

GET /api/reports
POST /api/reports
PUT /api/reports/{id}
DELETE /api/reports/{id}
GET /api/2.0/reports/{condition, location, username}

Path Parameters

Parameter Type Default Required Description
condition string none false Return matches by name.
location string none false Return any bean from a specific country or region of origin.
username string none false Return bean matches with a specific flavor profile.

..........................................................................................

Usage / Examples

Planned Features

No new features are planned at this time.

Known Bugs

There are no known bugs

Technology Used

  • C# 7.3
  • .NET Core 2.2
  • Entity
  • Git
  • MySQL
  • CSS
  • HMTL
  • Bootstrap
  • Razor
  • dotnet script, REPL
  • Mvc.Versioning 4.1.0
  • Swachbuckle 5.5.0

Authors and Contributors

Authored by: Ryland Adams Authored by: Kevin Kirkley Authored by: Max Brockbank

Contact

Ryland Adams - [email protected] Kevin Kirkley [email protected] Max Brockbank - [email protected]

License

GPLv3

Copyright © 2020 Ryland Adams, Kevin Kirkley, Max Brockbank

mtsafe.solution's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.