{"id":18024210,"url":"https://github.com/robisim74/angularcliaspnetcore","last_synced_at":"2025-03-27T00:30:56.088Z","repository":{"id":143841950,"uuid":"109526004","full_name":"robisim74/AngularCliAspNetCore","owner":"robisim74","description":"Angular CLI \u0026 ASP.NET Core WebAPI in the same project","archived":false,"fork":false,"pushed_at":"2018-10-22T16:33:05.000Z","size":766,"stargazers_count":19,"open_issues_count":0,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-22T18:11:24.233Z","etag":null,"topics":["angular","angular-cli","aot-compilation","aspnet-core","webapi"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/robisim74.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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-11-04T19:59:01.000Z","updated_at":"2022-04-22T21:05:37.000Z","dependencies_parsed_at":"2023-07-02T20:30:48.102Z","dependency_job_id":null,"html_url":"https://github.com/robisim74/AngularCliAspNetCore","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robisim74%2FAngularCliAspNetCore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robisim74%2FAngularCliAspNetCore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robisim74%2FAngularCliAspNetCore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robisim74%2FAngularCliAspNetCore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robisim74","download_url":"https://codeload.github.com/robisim74/AngularCliAspNetCore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245760616,"owners_count":20667886,"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":["angular","angular-cli","aot-compilation","aspnet-core","webapi"],"created_at":"2024-10-30T07:12:10.208Z","updated_at":"2025-03-27T00:30:56.082Z","avatar_url":"https://github.com/robisim74.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular CLI ASP.NET Core\n\n\u003e Angular CLI \u0026 ASP.NET Core WebAPI in the same project. Angular AoT compilation in development \u0026 production mode.\n\nGet the [Changelog](https://github.com/robisim74/AngularCliAspNetCore/blob/master/CHANGELOG.md).\n\n## Features\n- Angular v7 \u0026 ASP.NET Core 2.1\n- Angular CLI\n- AoT compilation in development \u0026 production mode\n- Angular CLI, .NET Core CLI or Visual Studio 2017\n- Angular Material\n\n## Project structure\n**AngularCliAspNetCore**\n- **Controllers**\n\t- **ValuesController.cs** _Resource API_\n- **Properties**\n\t- **lanchSettings.json** _ASP.NET Core environments_\n- **ClientApp** _Angular application_\n- **wwwroot** _Root for Angular application deployment_\n- **Startup.cs** _WebAPI configuration_\n\n## Installing\n- Requirements\n\t- At least [.NET Core 2.1](https://www.microsoft.com/net/download/core)\n\t- [Node.js and npm](https://nodejs.org)\n    - At least [Angular CLI 7.0.0](https://github.com/angular/angular-cli)\n\n#### Command line \u0026 .NET Core CLI\n- In _ClientApp_ folder run: `npm install`\n- `dotnet build`\n\n#### Visual Studio 2017\n- In _ClientApp_ folder run: `npm install`\n- Build the solution\n\n## Running\nThe app will be served on `https://localhost:5001`\n\n### Command line \u0026 .NET Core CLI\n#### Development\n- `dotnet watch run`\n\n#### Staging\n- In _ClientApp_ folder run: `npm run build`\n- `dotnet run --launch-profile Staging`\n\n### Visual Studio 2017\n#### Development\n- Select _AngularCliAspNetCore_ profile\n- Start debugging\n\n#### Staging\n- In _ClientApp_ folder run: `npm run build`\n- Select _Staging_ profile\n- Start debugging\n\n## Start from scratch\n- Create the ASP.NET Core WebAPI:\n```Shell\ndotnet new webapi -o AngularCliAspNetCore\n```\n- Create the Angular app:\n```Shell\ncd AngularCliAspNetCore\nng new --skipGit=true ClientApp\n```\n- Open `angular.json` file and set the `outputPath`:\n```Shell\n\"outputPath\": \"../wwwroot\"\n```\n- Open `package.json` file and set the following scripts:\n```Json\n\"start\": \"ng serve --aot\",\n\"build\": \"ng build --prod\",\n```\n- Open `Startup.cs` file and add to the `ConfigureServices` method:\n```C#\nservices.AddSpaStaticFiles(configuration =\u003e\n{\n\tif (Environment.GetEnvironmentVariable(\"ASPNETCORE_ENVIRONMENT\") == \"Development\")\n\t{\n\t\tconfiguration.RootPath = \"ClientApp/dist/ClientApp\";\n\t}\n\telse\n\t{\n\t\tconfiguration.RootPath = \"wwwroot\";\n\t}\n});\n```\nand to `Configure` method:\n```C#\napp.UseStaticFiles();\napp.UseSpaStaticFiles();\n\napp.UseMvc(routes =\u003e\n{\n\troutes.MapRoute(\n\t\tname: \"default\",\n\t\ttemplate: \"{controller}/{action=Index}/{id?}\");\n});\n\napp.UseSpa(spa =\u003e\n{\n\tspa.Options.SourcePath = \"ClientApp\";\n\n\tif (env.IsDevelopment())\n\t{\n\t\tspa.UseAngularCliServer(npmScript: \"start\");\n\t}\n});\n```\n- Open [launchSettings.json](https://github.com/robisim74/AngularCliAspNetCore/blob/master/Properties/launchSettings.json) file and update the environments.\n\nFor other features, refer to the repository.\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobisim74%2Fangularcliaspnetcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobisim74%2Fangularcliaspnetcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobisim74%2Fangularcliaspnetcore/lists"}