How would you store the data for a blog posts with .NET and Entity Framework?
Trying to wrap my head around how this would work and a lot of information use PHP and are from 10+ years ago, so it's not fully relevant at the moment for what I'm doing (at least I don't think so?).
I am setting up a blog like website. There will be posts, with potentially a lot of characters. I've heard that the best way to handle posts is to essentially have them saved as html or markdown files in a server and have the SQL table link to the location of this. The only thing is I have no idea where to start looking for how to do that. What's this called? When I attempt to search up static html files, I get information on how to use MVC which isn't what I need. I have Angular as my frontend and .NET 8 as my backend. Currently it's only running locally so I'm doing everything through SQL Server Management. Servers are a weakness of mine, so I don't fully know what I'm doing, any sources or documentation or articles would be very appreciated.
3 Replies
so I've been trying to do some studying on this since posting this yesterday. It seems that the way to do it involves saving the posts as static files in the wwwroot folder and using a file reader of some kind with Angular? But I'm not completely certain. I also see discussion about the wwwroot being used solely for the client-side html files. Are these just two different schemas that could be used, or am I misusing the wwroot folder with this idea?
actually I think the most straightforward thing at the moment would be treating it like any other file that could be uploaded by the user -- such as a pdf -- and then download and display it in the client when accessed. It may not be very efficient, but I think I'll find the most resources on how to do this safely
If it is only a blog, why did you choose a .NET + angular + SQL stack?
If it is just you that will be making posts, using an Astro blog template would be a very easy way. If it is also other users, you could use DecapCms. Easier and cheaper (free) to set up than running a server with .net and sql.
just for personal exercises mostly. I've worked in .NET and Angular mostly and I'm looking for a new job in that field so I'm trying to get a handle on how it works with SQL mostly since that's always been my weakest part