{"id":24401806,"url":"https://github.com/valadas/dotnetwebapistencil","last_synced_at":"2025-03-13T06:43:56.201Z","repository":{"id":271988660,"uuid":"915196327","full_name":"valadas/DotnetWebapiStencil","owner":"valadas","description":"A dotnet WebApplication template that uses Stencil.js for the frontend","archived":false,"fork":false,"pushed_at":"2025-01-13T18:11:54.000Z","size":115,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-01-20T00:48:42.851Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/valadas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2025-01-11T08:05:07.000Z","updated_at":"2025-01-13T18:11:57.000Z","dependencies_parsed_at":"2025-01-20T00:47:26.799Z","dependency_job_id":null,"html_url":"https://github.com/valadas/DotnetWebapiStencil","commit_stats":null,"previous_names":["valadas/dotnetwebapistencil"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valadas%2FDotnetWebapiStencil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valadas%2FDotnetWebapiStencil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valadas%2FDotnetWebapiStencil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valadas%2FDotnetWebapiStencil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valadas","download_url":"https://codeload.github.com/valadas/DotnetWebapiStencil/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243358212,"owners_count":20277991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-01-20T00:47:21.728Z","updated_at":"2025-03-13T06:43:56.195Z","avatar_url":"https://github.com/valadas.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dotnet WebAPI with Stencil.js SPA Middleware Template\r\n\r\nThis project template provides a starting point for building a .NET WebAPI application integrated with a Stencil.js-based Single Page Application (SPA). It includes middleware for running the Stencil development server during development and serving the static files during production.\r\n\r\n## Features\r\n\r\n- **API and SPA Integration**: Combines WebAPI endpoints with a modern Stencil.js frontend.\r\n- **Development Server Support**: Seamlessly proxies requests to the Stencil.js development server during development.\r\n- **Production-Ready Setup**: Serves static files from a specified `wwwroot` directory in production.\r\n- **TypeScript Client Generation**: Automatically generates TypeScript clients for the API controllers.\r\n\r\n---\r\n\r\n## Using the template\r\n\r\nTo install the template, run `dotnet new install Eraware.StencilWebApiTemplate`\r\n\r\nTo create a project using the template, create a folder using whatever project name you would like, then inside that folder run `dotnet new webapi-stencil-starter`.\r\n\r\nAlternatively you can use -n to name your project and -o to set the output folder. Ex `dotnet new webapi-stencil-starter -n MyProject -o ./MyProject`\r\n\r\nThen inside the folder simply run `dotnet watch` and you can start coding both the backend and frontent while enjoying live-reload and HMR.\r\n\r\nIf you prefer a Visual Studio workflow you can simply open the project file and Visual Studio will propose making it a solution.\r\n\r\n## Using the Stencil SPA Middleware\r\n\r\nThe middleware makes it easy to integrate a Stencil.js SPA into your application. It proxies requests during development to the Stencil.js development server and serves static files in production.\r\n\r\n### Configuration\r\n\r\nTo use the middleware:\r\n\r\n1. Add the services and the middleware to your app's startup logic :\r\n\r\n   ```csharp\r\n   services.AddStencil();\r\n   ...\r\n    if (app.Environment.IsDevelopment())\r\n    {\r\n        app.UseSpa(spa =\u003e\r\n        {\r\n            spa.Options.SourcePath = \"wwwroot/www\";\r\n            spa.UseStencilDevelopmentServer();\r\n        });\r\n    }\r\n    else\r\n    {\r\n        app.UseSpaStaticFiles(\"wwwroot/www\");\r\n    }\r\n    ...\r\n    ```\r\n2. Create your stencil app at `wwwroot/www`.\r\n3. Run `dotnet watch` and enjoy live-reload.\r\n4. Modify your APIs and get automatic client classes in typescript generated upon build.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaladas%2Fdotnetwebapistencil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaladas%2Fdotnetwebapistencil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaladas%2Fdotnetwebapistencil/lists"}