Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Bhargav Bachina bbachi

💭
I may be slow to respond.
  • Rogers, AR
View GitHub Profile
@bbachi
bbachi / manifest.yml
Last active Feb 28, 2021
Angular DOTNET
View manifest.yml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: angular-webapp
name: angular-webapp
spec:
replicas: 5
selector:
@bbachi
bbachi / service.yml
Last active Feb 28, 2021
Angular DOTNET
View service.yml
apiVersion: v1
kind: Service
metadata:
name: angular-webapp
labels:
run: angular-webapp
spec:
ports:
- port: 80
protocol: TCP
@bbachi
bbachi / deployment.yml
Last active Feb 28, 2021
Angular DOTNET
View deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: angular-webapp
name: angular-webapp
spec:
replicas: 10
selector:
@bbachi
bbachi / pod.yml
Created Feb 28, 2021
angular dotnet
View pod.yml
apiVersion: v1
kind: Pod
metadata:
name: webapp
spec:
containers:
- image: docker.io/bbachin1/angular-dotnet-webapp
name: webapp
imagePullPolicy: Always
@bbachi
bbachi / Dockerfile
Created Feb 27, 2021
Angular DOTNET
View Dockerfile
# https://hub.docker.com/_/microsoft-dotnet
FROM mcr.microsoft.com/dotnet/sdk:5.0.103 AS build
WORKDIR /build
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
# copy csproj and restore as distinct layers
COPY ./*.csproj .
RUN dotnet restore
View Startup.cs
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
// In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "ClientApp/dist";
});
}
View Startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.SpaServices.AngularCli;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace angular_dotnet_example
{
View Startup.cs
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
View UsersController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace angular_dotnet_example.Controllers
View IUserRepository.cs
using System;
using System.Collections.Generic;
namespace angular_dotnet_example.Models
{
public interface IUserRepository
{
IEnumerable<UserModel> GetAll();
UserModel Add(UserModel user);