{"id":16901988,"url":"https://github.com/jpf/dotnet-core-and-nancy-example","last_synced_at":"2026-02-14T08:02:21.551Z","repository":{"id":66595790,"uuid":"79397670","full_name":"jpf/dotnet-core-and-nancy-example","owner":"jpf","description":"A short writeup of what it took for me to get a basic working \"hello world\" application working with .NET and Nancy on my Mac.","archived":false,"fork":false,"pushed_at":"2017-01-19T00:10:07.000Z","size":3,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-11T01:47:18.634Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-19T00:09:17.000Z","updated_at":"2023-11-20T22:39:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b59b530-0441-440a-b839-51ebdeee0be7","html_url":"https://github.com/jpf/dotnet-core-and-nancy-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jpf/dotnet-core-and-nancy-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpf%2Fdotnet-core-and-nancy-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpf%2Fdotnet-core-and-nancy-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpf%2Fdotnet-core-and-nancy-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpf%2Fdotnet-core-and-nancy-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpf","download_url":"https://codeload.github.com/jpf/dotnet-core-and-nancy-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpf%2Fdotnet-core-and-nancy-example/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29439821,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T07:24:13.446Z","status":"ssl_error","status_checked_at":"2026-02-14T07:23:58.969Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T18:03:16.775Z","updated_at":"2026-02-14T08:02:21.535Z","avatar_url":"https://github.com/jpf.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [.NET Core and Nancy example code](#org94c5fde)\n- [Step 1: Install .NET Core](#org320aa52)\n- [Step 2: Create the files needed for the example](#orgd0bf219)\n  - [project.json](#org9ac7c6b)\n  - [Startup.cs](#org960fdef)\n  - [Main.cs](#orgd2e2385)\n  - [HomeModule.cs](#orgb9af79d)\n- [Step 3: Run the example](#orgff68563)\n\n\n\u003ca id=\"org94c5fde\"\u003e\u003c/a\u003e\n\n# .NET Core and Nancy example code\n\nThis is a short writeup of what it took for me to get a basic working \"hello world\" application working with .NET and Nancy on my Mac.\n\nThis is based on Scott Hanselman's blog post \"[Exploring a minimal WebAPI with .NET Core and NancyFX](http://www.hanselman.com/blog/ExploringAMinimalWebAPIWithNETCoreAndNancyFX.aspx)\", with the modifications that I needed to get it working for myself.\n\n\n\u003ca id=\"org320aa52\"\u003e\u003c/a\u003e\n\n# Step 1: Install .NET Core\n\nFirst step is to [install .NET core](https://www.microsoft.com/net/core), this is pretty easy to do, just follow the instructions. You'll know that the install worked if you can type this in your terminal and see a result:\n\n```sh\ndotnet --version\n```\n\n\n\u003ca id=\"orgd0bf219\"\u003e\u003c/a\u003e\n\n# Step 2: Create the files needed for the example\n\nTo get the example working, you'll need to create four files:\n\n1.  project.json\n2.  Startup.cs\n3.  Main.cs\n4.  HomeModule.cs\n\nSee below for what each file should contain.\n\n\n\u003ca id=\"org9ac7c6b\"\u003e\u003c/a\u003e\n\n## project.json\n\n```javascript\n{\n  \"version\": \"1.0.0-*\",\n  \"buildOptions\": {\n    \"debugType\": \"portable\",\n    \"emitEntryPoint\": true\n  },\n  \"dependencies\": {\n    \"Microsoft.NETCore.App\": {\n      \"version\": \"1.1.0\",\n      \"type\": \"platform\"\n    },\n    \"Microsoft.AspNetCore.Server.Kestrel\": \"1.1.0\",\n    \"Microsoft.AspNetCore.Owin\": \"1.1.0\",\n    \"Nancy\": \"2.0.0-barneyrubble\"\n  },\n  \"commands\": {\n    \"web\": \"Microsoft.AspNet.Server.Kestrel\"\n  },\n  \"frameworks\": {\n    \"netcoreapp1.0\": {}\n  }\n}\n```\n\n*Note:* I had to change the version numbers from \"1.0.0\" to \"1.1.0\" to get things to work.\n\n\n\u003ca id=\"org960fdef\"\u003e\u003c/a\u003e\n\n## Startup.cs\n\n```java\nusing Microsoft.AspNetCore.Builder;\nusing Nancy.Owin;\n\nnamespace NancyApplication\n{\n   public class Startup\n    {\n        public void Configure(IApplicationBuilder app)\n        {\n            app.UseOwin(x =\u003e x.UseNancy());\n        }\n   }\n}\n```\n\n\n\u003ca id=\"orgd2e2385\"\u003e\u003c/a\u003e\n\n## Main.cs\n\n```java\nusing System.IO;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\n\nnamespace NancyApplication\n{\n    public class Program\n    {\n        public static void Main(string[] args)\n        {\n            var host = new WebHostBuilder()\n                .UseContentRoot(Directory.GetCurrentDirectory())\n                .UseKestrel()\n                .UseStartup\u003cStartup\u003e()\n                .Build();\n\n            host.Run();\n        }\n    }\n}\n```\n\n\n\u003ca id=\"orgb9af79d\"\u003e\u003c/a\u003e\n\n## HomeModule.cs\n\n```java\nusing Nancy;\nnamespace NancyApplication\n{\n    public class HomeModule : NancyModule\n    {\n        public HomeModule()\n        {\n            Get(\"/\", args =\u003e \"Hello World. This is pretty cool!\");\n            Get(\"/test/{name}\", args =\u003e new Person() { Name = args.name });\n        }\n    }\n\n    public class Person\n    {\n        public string Name { get; set; }\n    }\n}\n```\n\n\n\u003ca id=\"orgff68563\"\u003e\u003c/a\u003e\n\n# Step 3: Run the example\n\nOnce you have created the four files needed for this sample, run the following command to \"restore\" the .NET dependencies listed in `project.json`:\n\n```sh\ndotnet restore\n```\n\nOnce that is complete, start up the example Nancy web server with this command:\n\n```\ndotnet run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpf%2Fdotnet-core-and-nancy-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpf%2Fdotnet-core-and-nancy-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpf%2Fdotnet-core-and-nancy-example/lists"}