API's in C#

     There is a lot here to take screen shots, but the code is all on my GitHub here if you'd like to follow along with this post.

     My wife teaches sixth grade, and lately I've been thinking about an application I could build her to help manager her classroom and motivate the students to improve on the skills they've been struggling with. The concept is to turn a classroom into a game of Dungeons & Dragons, except the skills are in things like math and reading. Students would answer questions instead of rolling dice, and can then add their skills to their results so they can earn experience and rewards. Originally I was going to build this in FastAPI but I thought .NET Core would be better for setting up models and working with a database.

    I started by setting up my models in a shared class library project, and I added a Classroom class for tracking classes of students, a Student class for tracking the stats of students and a Logs class to keep track of how a students skills are increasing or how often students are being obedient or disobedient. Once I had an idea of how my models were set up I got an API project up and set up a services folder to hold my DB Context, Data Service and and my EFCore Repository to handle my Postgres CRUD operations. Then I was ready to set up a controller to actually start making API calls.

    The controller held my basic API calls, and it was easy to get that running. Once I ran migrations on my database I was able to open up Swagger and start adding students and classrooms. I had a working API that connected to a database in only a couple of hours. I decided to add some validation to my API calls to ensure I wasn't allowing malicious things like XSS or SQL injection into my database. I added a Validation Service with some Regex and checks to ensure stats aren't things like negative values. If invalid data is passed to my controller, a 400 response will be triggered.

Comments

  1. So, make certain to check them out before making an attempt to avail of the bonus. These websites are legit and only encourage authorized online playing. The growing investments within the online playing market can 카지노 be primarily credited to the rising demand for cost-effective payment mechanisms. Another essential issue favoring investments in online playing is the introduction of digital and augmented reality.

    ReplyDelete

Post a Comment

Popular posts from this blog

Reviewing WPF and MVVM

Using WebRTC to build a videophone in React and TypeScript

Learning Flutter