So, basically 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: Gee, 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.
Question: 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?
Thanks you all in advance
You have three choices:
JsonResult
and call that from your AJAX method
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.