Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • nickornotto 312 posts 674 karma points
    6 days ago
    nickornotto
    0

    Free Umbraco CMS with React.js?

    Is there any way of using Umbraco CMS with React.js front-end other than with Headless?

    I've seen tutorials on how to use React.js at the front-end but they seem to be already outdated and not sure whether those solutions will be viable in the future updates to Umbraco.

    If the direction Umbraco takes right now giving the solution of only the Heartcore as a base for SPA with its CMS then I am afraid it's the end of free Umbraco for small business/ enthousiasts websites. Heartcore is simply expensive.

    What do you think?

  • Nik 1336 posts 5726 karma points MVP 3x c-trib
    6 days ago
    Nik
    0

    Hi Nick,

    Have a look at the HeadRest package for exposing end points for accessing content. I.e. turning the CMS headless.

    For heartcore projects, HeadRest is probably your only real option, or you can write your own api controllers to handle the requests.

    The Umbraco open source CMS has never been headless out of the box, so it's always been a case of installing a package or creating your own API end points to achieve it I believe.

    Thanks

    Nik

  • Casper 68 posts 304 karma points
    5 days ago
    Casper
    0

    You don't need 3. party things, to make things headless. That said, you can' directly serialize IPublishedContent, so you will need to write your own conversion logic.

    Either create a class inheriting from RenderMvcController that replaces the default Umbraco controller, or create one for each route you wan't to hijack. See: https://our.umbraco.com/documentation/reference/routing/custom-controllers

    Ex:

    public class HeadlessController : RenderMvcController
    {
        public ActionResult Index(IPublishedContent model)
        {
            var serializableThing = ...convert your  model...";
    
            return new ContentResult
            {
                Content = JsonConvert.SerializeObject(serializableThing),
                ContentEncoding = Encoding.UTF8,
                ContentType = "application/json"
            };
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft