GithubHelp home page GithubHelp logo

animalshelter.solution's Introduction

AnimalShelter.Solution

By Jeremy Banka

Technologies Used

  • ๐ŸŽต C# / .NET 5 Framework
  • ๐Ÿ”ฅ Blazor WebAssembly Frontend
  • ๐Ÿ›‚ JWT Session Authentication
  • ๐ŸŽ›๏ธ ASP.NET Core Server
  • ๐Ÿ‘‡ Entity Framework Core
  • ๐Ÿ‹ Pomelo MySQL interface
  • ๐Ÿงฎ MySQL Database
  • ๐Ÿดโ€โ˜ ๏ธ Swagger API Documentation Framework
  • ๐Ÿ’… SCSS to CSS via Ritwick's Live Sass Compiler
  • ๐Ÿ› ๏ธ Tooling: Omnisharp
  • ๐Ÿ…ฐ๏ธ Font: Palatino by Hermann Zapf (PBUH)

Description

This is a project to create a simple web api and client.

  • The api allows basic CRUD functionality for various pet-themed database records, as well as basic user auth.
  • ASP.Net Identity was not used in this production. Cryptography was implemented manually.
  • You will not get owned. User passwords are salted ๐ŸŽฒ and hashed โ™ป๏ธโ™ป๏ธโ™ป๏ธ for privacy.
  • Which currently means, don't forget your password. It doesn't keep it; there's no recovery mechanism ๐Ÿ˜.
  • Single-page client is written in C# Blazor (NO JS ๐Ÿคฏ). The C# compiles directly to WebAssembly.

Setup/Installation Requirements

Getting Started

  • Get the source code: $ git clone https://github.com/jeremybanka/AnimalShelter.Solution

  • Set up necessary database schema

    • Install Entity Framework CLI: $ dotnet tool install --global dotnet-ef
    • Build your database: in WebApi/, run dotnet ef database update
  • Add appsettings.json in WebApi/ and paste in the following text:

    {
      "AppSettings": {
        "Secret": "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
      },
      "Logging": {
        "LogLevel": {
          "Default": "Information",
          "Microsoft": "Warning",
          "Microsoft.Hosting.Lifetime": "Information"
        }
      },
      "ConnectionStrings": {
        "DefaultConnection": "Server=localhost;Port=3306;database=animal_shelter;uid=root;pwd=************;"
      }
    }

    except, instead of ************ put your personal password for MySQL.

    and instead of !!!!!!!!!!!!!!!!!!!!!!!!!!!!! put a (very) long string. This will be used to create JWT tokens.

  • Compile and run the API server as you save changes: $ dotnet watch run in WebApi/ (This command will also install necessary dependencies.) It ought to prompt Swagger to open in your browser. But if it doesn't, just go to http://localhost:6144/swagger.

  • Once the server's running, do a $ dotnet watch run in Blazor/. Again, this will install the dependencies needed.

  • The API server runs on :6144; the client, on :5000. The client's already pointing at the correct port.

Authentication

The api routes in this application are not currently restricted to authorized users. This means you don't actually need an account to use the api, just to see certain pages in the client. If you want an account, there are two ways.

UI Way The UI is total crap, but it does work, for auth at least ๐Ÿ˜….

  • Go to http://localhost:5000/register
  • Enter in your details, ensuring the passwords match. There are no restrictions set on password length or security!
  • Submit the form, then log in using the creds you created.
  • This will permit you to access the other client routes, which don't do much of anything execpt withhold themselves from unauthenticated users.

Cool Behind-the-Scenes Way

  • Go to http://localhost:6144/swagger
  • Click into "POST /Users/register" and "Try it out"
  • Execute with details you will remember, ensuring the passwords match.
  • Click into "POST /Users/login" and "Try it out"
  • Execute with the details from before. The response will contain your details (except password, which the server doesn't know), as well as a 'token', which is like a temporary password.

Using API Endpoints

  • Go to http://localhost:6144/swagger
  • To see all the cats and dogs at the shelter, click into "GET /api", "Try it out", then "Execute"
  • No animals will be harmed. Instead, you'll see all the animals that are here!
  • Which is none, unless you made some already.
  • To make a cat, for example, click into "POST /api/cats/", "Try it out", and "Execute", adding a value for "name" you think would befit a cat.
  • Making a dog works exactly the same.
  • To delete, view, or make changes to a particular pet, request all, as above, copy the "id" of the pet in question, and supply it to the http method of your choice in the "id" field.

Known Bugs

  • none identified

License

Gnu Public License ^3.0

Contact Information

hello at jeremybanka dot com

animalshelter.solution's People

Contributors

jeremybanka avatar

Watchers

 avatar  avatar

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.