I have a blog website that I developed using ASP.NET with Razor Pages but, now I want to implement those blog posts on my personal portfolio website (Built with simple HTML, CSS and JS).
My first thought was that I now need to create an ASP.NET API from scratch to connect to the same blog database and then fetch it all with JS from my Portfolio Website.
Would I actually need to create a brand new API just for that or is there any way I can turn the existing blog into an API that can be called externally? Or somehow add an API endpoint that instead of rendering the pages just sends the Json data back to the client?
You have three choices:
JsonResult
and call that from your AJAX method