Last active
November 22, 2019 19:35
-
-
Save InvaderZim85/9fda89e17077bc7cf65450ce3114944f to your computer and use it in GitHub Desktop.
Usage of the custom attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public sealed class InfoModule : NancyModule | |
{ | |
[RouteDescription("HelloRoute", "Returns a simple hello message.")] | |
[RouteDescription("InfoRoute", "Returns the current date time and a short hello message.")] | |
public InfoModule() | |
{ | |
Get("/", _ => Response.AsText("Hello from Nancy!", name: "HelloRoute"); | |
Get("/info", _ => | |
{ | |
var info = new | |
{ | |
Date = DateTime.Now, | |
Message = "Hello World!" | |
}; | |
return Response.AsJson(info); | |
}, name: "InfoRoute"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment