- Nancy official website--https://github.com/nancyfx/nancy
- Overview: Nancy is an open source Web lightweight framework kernel that conforms to the MVC concept, has the features of easy development, simple routing, and is fully functional
- Start: Hellow World
I. Creating an ASP. NET Web Application
Two. Add a reference to the Nancy package using NuGet
Three. Add a reference to Nancy
Add the above two to use Nancy to build the application, such as some small interface, the following article will give this application
If you need a page, then you need a view engine, Nancy has built multiple view engines for us, and I've used only two of them so far.
1 "Spark
2 "Razor
There are a lot of differences between the two view engine syntax, which are all, but razor is more appropriate if you are using VS for development.
Add Razor View engine
OK to this environment, the Code (note: You must establish the Views folder in the project root directory, Nancy lookup view by default from the file)
Public class Hellomodule:nancymodule { public hellomodule () { get["/hello"] = p = = { return view["Hello"];} ; }
Project structure: