GarrettAnderson / assignments

1 stars 0 forks source link

Week 08 - Day 3 - Take the Safari Online #29

Closed mdewey closed 5 years ago

mdewey commented 5 years ago

Take the Safari Online.

Let's Continue our safari adventure

We are taking a surprise trip to the Savannah for a safari to see all sorts of exotic animals. During our time their we want to keep track of all the animals we have seen. For this, we need to create an API to help record what we see.

Objectives

Requirements

For .NET Students, install the sdg-api template using the command dotnet new -i SDG.templates.Web.API

Explorer Mode (C#)

Explorer Mode (Ruby)

Adventure Mode (C#)

Adventure Mode (Ruby)

Epic Mode

Additional Resources

.NET

Here are the interesting commands you will need for tonight's assignment

 dotnet add package Microsoft.EntityFrameworkCore.Design --version 2.1.3

 dotnet add package Npgsql.EntityFrameworkCore.PostgreSQL --version 2.1.2
createdb <<DatabaseName>>
dotnet ef dbcontext scaffold "server=localhost;database=<<DatabaseName>>" Npgsql.EntityFrameworkCore.PostgreSQL -c <<DatabaseName>>Context
 dotnet ef migrations add AddBaordGameTable
dotnet ef database update

NOTES:

GarrettAnderson commented 5 years ago

Wasnt sure where to find in the documentation how to specify the query to a specific species. Wrote what I think makes sense but I dont get a return of just the lion species object instead i get a return of all the animals. Tried some things but got 404 error and what I have so far at lease doesn't crash the page. Would like to find out what i'm missing.

GarrettAnderson commented 5 years ago

https://github.com/GarrettAnderson/safari2

GarrettAnderson commented 5 years ago

I was able to create a new animal but wasn't thinking and pressed enter before entering data. so Animal with id: 6 has nil values.

GarrettAnderson commented 5 years ago

I was able to see the json data in localhost but was not able to get a read from postman. Not sure what to make of that.