Various notes that I was using for the live stream I did on 26-11-2017. The full show notes (and an embedded player) for the stream are available at: https://dotnetcore.gaprogman.com/portfolio-post/spas-a-plenty/
These where used during the stream to provide important information to the viewers (and myself) on the topic of .NET Core's support for Single Page Applications and on Feature Folders.
3. Stuff I’ll Use
● Terminal / Bash / Command Line (CLI)
● Rider / VS Code
● Chrome
4. Plan
● Replace Web project with Angular SPA Template
● Separate APi and MVC controllers (Feature Folders)
● Use Services in API
● Google external Auth <= If there’s time
5. SPA setup
● dotnet net angular --name “nameOfProjectHere”
● cd into new directory
● npm install (takes a long time, have done it already)
● ASPNETCORE_ENVIRONMENT=Development dotnet run
6. Feature Folders
● There are NuGet packages for this, but most are old
● It’s super easy to do
● https://github.com/GaProgMan/FullStackTemplate/tree/master/FullStackT
emplate.UI <= Example
7. Using the Services in our API
● Call the APi using `BASE_URL`
● `Http` is used for Http requests
● `BASE_URL` gets us the base url from the request
● BaseComponent
Editor's Notes
https://github.com/GaProgMan/FullStackTemplate/blob/master/FullStackTemplate.UI/ConfigureContainerExtenstions.cs#L85
Which calls
https://github.com/GaProgMan/FullStackTemplate/blob/master/FullStackTemplate.UI/FeatureLocationExpander.cs
constructor(http: Http, @Inject('BASE_URL') protected baseUrl: string) {
super(baseUrl, http);
export class BaseComponent {
constructor(private originUrl: string, public http: Http) { }
apiUrl = () :string => {
return `${this.originUrl}api/`;
}
}
If lost/confused take a look at `home.component.ts`