frankcollins3 / ASPokedex

Pokedex with ASP backend / razor pages, and VanillaJS front end
1 stars 0 forks source link

cannot connect to API. [7:12am] #16

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

attempting to do: connect to the API.

we atleast know the connection string is correct because _EMFMigrationsHistory is added as a table into postgres. Screen Shot 2023-09-21 at 7 09 52 AM

error: 404 not found

proposed approach: 0: if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error"); 👎 app.UseMigrationsPipeline(); // WebApplication' does not contain a definition for 'UseMigrationsPipeline // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); }

possible improvements:

frankcollins3 commented 1 year ago

here's the PokemonController and a minimum-viable attempt at linking to the API in postman Screen Shot 2023-09-21 at 7 12 04 AM

Screen Shot 2023-09-21 at 7 13 31 AM [7:15am]

frankcollins3 commented 1 year ago

// tried to not clip the person's name into the screenshot by this person's person statement.. I'm not trying to create just a pure REST API. This is a simple razor app so then I would not AddControllersWithViews();

Screen Shot 2023-09-21 at 7 28 58 AM [7:32am]

frankcollins3 commented 1 year ago

found this ASP app that has the migrations within the folders and imports the data in Program.cs which mine doesn't: Screen Shot 2023-09-21 at 7 36 12 AM Screen Shot 2023-09-21 at 7 36 05 AM [7:36pm]

frankcollins3 commented 1 year ago

creating a namespace for: Data/ApplicationDbContext I think this error indicates a naming conflict between the namespace endpoint and the type in the public class Screen Shot 2023-09-21 at 8 15 01 AM [8:16am]

frankcollins3 commented 1 year ago

mapping the endpoints was what was missing and chatGPT never thought to mention it (which is ok): Screen Shot 2023-09-22 at 6 26 33 AM saw this code and explanation on stack overflow with mentions distincting: 1: entity framework backend only // I used code that corresponded to backend EF only. 2: entity framework, Razor Pages/Full-stack ASP only app [6:28am]