Forum Discussion

dlwiii's avatar
dlwiii
Copper Contributor
Nov 12, 2021

Suggestions on how best to move from Nancy to ASPNet Core?

We have a Framework solution which has two projects that run on Nancy.  And since Nancy is dead we need to migrate to something else, and I want that to be on Core.     Has anyone  done this before, and do you have any suggestions?

One daunitng task is simply changing all the endpoints, things like this:

 

Get("/", args => { return GetJobToRun(); });
Post("/", args => { return AddNewJob(); });

Get("/shuttle_info", args =>
{
var results = Shuttles.Select(v => v.Value).ToList();
return results;
});

 

 

We have about 200 such declarations.  So looking for the smoothest way to transition to ...  I really don't know what.  MVC has way too much ceremony.  Is there a nice core framework that allows us to cleanly easily declare paths and http methods?

 

Thanks!

Daniel

 

 

  • shawnwildermuth's avatar
    shawnwildermuth
    Copper Contributor
    Nancy and Minimal APIs in .NET 6 have a lot in common. You should see how Minimal APIs work, you should be able to craft a solution that keeps your business logic likely untouched.
    • dlwiii's avatar
      dlwiii
      Copper Contributor

      shawnwildermuth  Thank you !  I will give it a try.  This will get me the simpler routings, but then is it just a matter of telling those endpoints to go to a CSHTML view?

       

       

      • shawnwildermuth's avatar
        shawnwildermuth
        Copper Contributor

        dlwiii If you're using Nancy for Routing to Views (not just APIs), then you'll want to dig into Razor Pages. That will allow you to do something similar.

Resources