diff --git a/ClientApp/app/app.module.browser.ts b/ClientApp/app/app.module.browser.ts index 70918765..940417cf 100644 --- a/ClientApp/app/app.module.browser.ts +++ b/ClientApp/app/app.module.browser.ts @@ -1,4 +1,4 @@ -import { NgModule } from '@angular/core'; +import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { APP_BASE_HREF } from '@angular/common'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; diff --git a/ClientApp/app/app.module.ts b/ClientApp/app/app.module.ts index 57498bb8..5ff6c419 100644 --- a/ClientApp/app/app.module.ts +++ b/ClientApp/app/app.module.ts @@ -13,154 +13,137 @@ import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { AppComponent } from './app.component'; import { NavMenuComponent } from './components/navmenu/navmenu.component'; import { HomeComponent } from './containers/home/home.component'; -import { UsersComponent } from './containers/users/users.component'; -import { UserDetailComponent } from './components/user-detail/user-detail.component'; import { CounterComponent } from './containers/counter/counter.component'; import { ChatComponent } from './containers/chat/chat.component'; import { NotFoundComponent } from './containers/not-found/not-found.component'; import { NgxBootstrapComponent } from './containers/ngx-bootstrap-demo/ngx-bootstrap.component'; import { LinkService } from './shared/link.service'; -import { UserService } from './shared/user.service'; import { ConnectionResolver } from './shared/route.resolver'; import { ORIGIN_URL } from './shared/constants/baseurl.constants'; import { TransferHttpModule } from '../modules/transfer-http/transfer-http.module'; export function createTranslateLoader(http: Http, baseHref) { - // Temporary Azure hack - if (baseHref === null && typeof window !== 'undefined') { - baseHref = window.location.origin; - } - // i18n files are in `wwwroot/assets/` - return new TranslateHttpLoader(http, `${baseHref}/assets/i18n/`, '.json'); + // Temporary Azure hack + if (baseHref === null && typeof window !== 'undefined') { + baseHref = window.location.origin; + } + // i18n files are in `wwwroot/assets/` + return new TranslateHttpLoader(http, `${baseHref}/assets/i18n/`, '.json'); } @NgModule({ - declarations: [ - AppComponent, - NavMenuComponent, - CounterComponent, - UsersComponent, - UserDetailComponent, - HomeComponent, - ChatComponent, - NotFoundComponent, - NgxBootstrapComponent - ], - imports: [ - CommonModule, - HttpModule, - FormsModule, - Ng2BootstrapModule.forRoot(), // You could also split this up if you don't want the Entire Module imported + declarations: [ + AppComponent, + NavMenuComponent, + CounterComponent, + HomeComponent, + ChatComponent, + NotFoundComponent, + NgxBootstrapComponent + ], + imports: [ + CommonModule, + HttpModule, + FormsModule, + Ng2BootstrapModule.forRoot(), // You could also split this up if you don't want the Entire Module imported - TransferHttpModule, // Our Http TransferData method + TransferHttpModule, // Our Http TransferData method - // i18n support - TranslateModule.forRoot({ - loader: { - provide: TranslateLoader, - useFactory: (createTranslateLoader), - deps: [Http, [ORIGIN_URL]] - } - }), + // i18n support + TranslateModule.forRoot({ + loader: { + provide: TranslateLoader, + useFactory: (createTranslateLoader), + deps: [Http, [ORIGIN_URL]] + } + }), - // App Routing - RouterModule.forRoot([ - { - path: '', - redirectTo: 'home', - pathMatch: 'full' - }, - { - path: 'home', component: HomeComponent, + // App Routing + RouterModule.forRoot([ + { + path: '', + redirectTo: 'home', + pathMatch: 'full' + }, + { + path: 'home', component: HomeComponent, - // *** SEO Magic *** - // We're using "data" in our Routes to pass in our <meta> <link> tag information - // Note: This is only happening for ROOT level Routes, you'd have to add some additional logic if you wanted this for Child level routing - // When you change Routes it will automatically append these to your document for you on the Server-side - // - check out app.component.ts to see how it's doing this - data: { - title: 'Homepage', - meta: [{ name: 'description', content: 'This is an example Description Meta tag!' }], - links: [ - { rel: 'canonical', href: 'http://blogs.example.com/blah/nice' }, - { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/' } - ] - } - }, - { - path: 'counter', component: CounterComponent, - data: { - title: 'Counter', - meta: [{ name: 'description', content: 'This is an Counter page Description!' }], - links: [ - { rel: 'canonical', href: 'http://blogs.example.com/counter/something' }, - { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/counter' } - ] - } - }, - { - path: 'users', component: UsersComponent, - data: { - title: 'Users REST example', - meta: [{ name: 'description', content: 'This is User REST API example page Description!' }], - links: [ - { rel: 'canonical', href: 'http://blogs.example.com/chat/something' }, - { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/users' } - ] - } - }, - { - path: 'chat', component: ChatComponent, - // Wait until the resolve is finished before loading the Route - resolve: { connection: ConnectionResolver }, - data: { - title: 'SignalR chat example', - meta: [{ name: 'description', content: 'This is an Chat page Description!' }], - links: [ - { rel: 'canonical', href: 'http://blogs.example.com/chat/something' }, - { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/chat' } - ] - } - }, - { - path: 'ngx-bootstrap', component: NgxBootstrapComponent, - data: { - title: 'Ngx-bootstrap demo!!', - meta: [{ name: 'description', content: 'This is an Demo Bootstrap page Description!' }], - links: [ - { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' }, - { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' } - ] - } - }, + // *** SEO Magic *** + // We're using "data" in our Routes to pass in our <title> <meta> <link> tag information + // Note: This is only happening for ROOT level Routes, you'd have to add some additional logic if you wanted this for Child level routing + // When you change Routes it will automatically append these to your document for you on the Server-side + // - check out app.component.ts to see how it's doing this + data: { + title: 'Homepage', + meta: [{ name: 'description', content: 'This is an example Description Meta tag!' }], + links: [ + { rel: 'canonical', href: 'http://blogs.example.com/blah/nice' }, + { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/' } + ] + } + }, + { + path: 'counter', component: CounterComponent, + data: { + title: 'Counter', + meta: [{ name: 'description', content: 'This is an Counter page Description!' }], + links: [ + { rel: 'canonical', href: 'http://blogs.example.com/counter/something' }, + { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/counter' } + ] + } + }, + { + path: 'chat', component: ChatComponent, + // Wait until the resolve is finished before loading the Route + resolve: { connection: ConnectionResolver }, + data: { + title: 'SignalR chat example', + meta: [{ name: 'description', content: 'This is an Chat page Description!' }], + links: [ + { rel: 'canonical', href: 'http://blogs.example.com/chat/something' }, + { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/chat' } + ] + } + }, + { + path: 'ngx-bootstrap', component: NgxBootstrapComponent, + data: { + title: 'Ngx-bootstrap demo!!', + meta: [{ name: 'description', content: 'This is an Demo Bootstrap page Description!' }], + links: [ + { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' }, + { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' } + ] + } + }, - { path: 'lazy', loadChildren: './containers/lazy/lazy.module#LazyModule'}, + { path: 'lazy', loadChildren: './containers/lazy/lazy.module#LazyModule' }, - { - path: '**', component: NotFoundComponent, - data: { - title: '404 - Not found', - meta: [{ name: 'description', content: '404 - Error' }], - links: [ - { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' }, - { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' } - ] - } - } - ], { - // Router options - useHash: false, - preloadingStrategy: PreloadAllModules, - initialNavigation: 'enabled' - }) - ], - providers: [ - LinkService, - UserService, - ConnectionResolver, - TranslateModule - ] + { + path: '**', component: NotFoundComponent, + data: { + title: '404 - Not found', + meta: [{ name: 'description', content: '404 - Error' }], + links: [ + { rel: 'canonical', href: 'http://blogs.example.com/bootstrap/something' }, + { rel: 'alternate', hreflang: 'es', href: 'http://es.example.com/bootstrap-demo' } + ] + } + } + ], { + // Router options + useHash: false, + preloadingStrategy: PreloadAllModules, + initialNavigation: 'enabled' + }) + ], + providers: [ + LinkService, + ConnectionResolver, + TranslateModule + ] }) export class AppModuleShared { } diff --git a/ClientApp/app/components/navmenu/navmenu.component.html b/ClientApp/app/components/navmenu/navmenu.component.html index 57b9c351..c04c145f 100644 --- a/ClientApp/app/components/navmenu/navmenu.component.html +++ b/ClientApp/app/components/navmenu/navmenu.component.html @@ -24,11 +24,6 @@ <span class='glyphicon glyphicon-education'></span> {{ 'COUNTER' | translate }} </a> </li> - <li [routerLinkActive]="['link-active']" (click)="collapseMenu()"> - <a [routerLink]="['/users']"> - <span class='glyphicon glyphicon-user'></span> Rest API Demo - </a> - </li> <li [routerLinkActive]="['link-active']" (click)="collapseMenu()"> <a [routerLink]="['/ngx-bootstrap']"> <span class='glyphicon glyphicon-th-large'></span> ngx-Bootstrap demo diff --git a/ClientApp/app/components/user-detail/user-detail.component.html b/ClientApp/app/components/user-detail/user-detail.component.html deleted file mode 100644 index 585bbe40..00000000 --- a/ClientApp/app/components/user-detail/user-detail.component.html +++ /dev/null @@ -1,9 +0,0 @@ -<div *ngIf="user"> - <h2>{{user.name}} details:</h2> - <div><label>id: </label>{{user.id}}</div> - <div> - <label>name: </label> - <input [(ngModel)]="user.name" placeholder="name" #details="ngModel" /> - </div> - <button [class.disabled]="details.pristine" class="btn btn-success" (click)="updateUser(user)">Save</button> -</div> \ No newline at end of file diff --git a/ClientApp/app/components/user-detail/user-detail.component.ts b/ClientApp/app/components/user-detail/user-detail.component.ts deleted file mode 100644 index 9db88355..00000000 --- a/ClientApp/app/components/user-detail/user-detail.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component, Input } from '@angular/core'; -import { IUser } from '../../models/User'; -import { UserService } from '../../shared/user.service'; - -@Component({ - selector: 'user-detail', - templateUrl: './user-detail.component.html' -}) -export class UserDetailComponent { - @Input() user: IUser; - - constructor(private userService: UserService) { } - - - updateUser(user) { - this.userService.updateUser(user).subscribe(result => { - console.log('Put user result: ', result); - }, error => { - console.log(`There was an issue. ${error._body}.`); - }); - } -} diff --git a/ClientApp/app/containers/users/users.component.css b/ClientApp/app/containers/users/users.component.css deleted file mode 100644 index 4e5440e1..00000000 --- a/ClientApp/app/containers/users/users.component.css +++ /dev/null @@ -1,64 +0,0 @@ -.selected { - background-color: #CFD8DC !important; - color: white; -} - -.users { - margin: 0 0 2em 0; - list-style-type: none; - padding: 0; - width: 15em; -} - - .users li { - cursor: pointer; - position: relative; - left: 0; - background-color: #EEE; - margin: .5em; - padding: .3em 0; - height: 2.4em; - border-radius: 4px; - } - - .users li:hover { - color: #607D8B; - background-color: #DDD; - left: .1em; - } - - .users li.selected:hover { - background-color: #BBD8DC !important; - color: white; - } - - .users .text { - position: relative; - top: -3px; - } - - .users .badge { - display: inline-block; - font-size: small; - color: white; - padding: 0.8em 0.7em 0 0.7em; - background-color: #607D8B; - line-height: 1em; - position: relative; - left: -1px; - top: -4px; - height: 2.5em; - margin-right: .8em; - border-radius: 4px 0 0 4px; - } -button.delete { - background-color: #eee; - border: none; - padding: 5px 10px; - border-radius: 4px; - float: right; - margin-top: 2px; - margin-right: .8em; - background-color: gray !important; - color: white; -} \ No newline at end of file diff --git a/ClientApp/app/containers/users/users.component.html b/ClientApp/app/containers/users/users.component.html deleted file mode 100644 index 5bb77691..00000000 --- a/ClientApp/app/containers/users/users.component.html +++ /dev/null @@ -1,29 +0,0 @@ -<h1>This is a RestAPI Example (hitting WebAPI in our case)</h1> - -<blockquote> - Let's get some fake users from Rest:<br> - You can find the Web API Routes in <code>{{ "/Server/RestAPI/ ... "}}</code> -</blockquote> - -<div> - <label>User name:</label> <input #userName /> - <button class="btn btn-default" (click)="addUser(userName.value); userName.value=''"> - Add - </button> -</div> - -<p *ngIf="!users"><em>Loading...</em></p> -<h2>Users</h2> -<ul class="users"> - <li *ngFor="let user of users" - [class.selected]="user === selectedUser" - (click)="onSelect(user)" - [@flyInOut]> - <span class="badge">{{user.id}}</span> {{user.name}} - <button class="delete" - (click)="deleteUser(user); $event.stopPropagation()"> - x - </button> - </li> -</ul> -<user-detail [user]="selectedUser"></user-detail> diff --git a/ClientApp/app/containers/users/users.component.ts b/ClientApp/app/containers/users/users.component.ts deleted file mode 100644 index 9dd28781..00000000 --- a/ClientApp/app/containers/users/users.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { - Component, OnInit, - // animation imports - trigger, state, style, transition, animate, Inject -} from '@angular/core'; -import { IUser } from '../../models/User'; -import { UserService } from '../../shared/user.service'; - -@Component({ - selector: 'users', - templateUrl: './users.component.html', - styleUrls: ['./users.component.css'], - animations: [ - // Animation example - // Triggered in the ngFor with [@flyInOut] - trigger('flyInOut', [ - state('in', style({ transform: 'translateY(0)' })), - transition('void => *', [ - style({ transform: 'translateY(-100%)' }), - animate(1000) - ]), - transition('* => void', [ - animate(1000, style({ transform: 'translateY(100%)' })) - ]) - ]) - ] -}) -export class UsersComponent implements OnInit { - - users: IUser[]; - selectedUser: IUser; - - // Use "constructor"s only for dependency injection - constructor(private userService: UserService) { } - - // Here you want to handle anything with @Input()'s @Output()'s - // Data retrieval / etc - this is when the Component is "ready" and wired up - ngOnInit() { - this.userService.getUsers().subscribe(result => { - console.log('Get user result: ', result); - console.log('TransferHttp [GET] /api/users/allresult', result); - this.users = result as IUser[]; - }); - } - - onSelect(user: IUser): void { - this.selectedUser = user; - } - - deleteUser(user) { - this.userService.deleteUser(user).subscribe(result => { - console.log('Delete user result: ', result); - if (result.ok) { - let position = this.users.indexOf(user); - this.users.splice(position, 1); - } - }, error => { - console.log(`There was an issue. ${error._body}.`); - }); - } - - addUser(newUserName) { - this.userService.addUser(newUserName).subscribe(result => { - console.log('Post user result: ', result); - if (result.ok) { - this.users.push(result.json()); - } - }, error => { - console.log(`There was an issue. ${error._body}.`); - }); - } -} diff --git a/ClientApp/app/models/User.ts b/ClientApp/app/models/User.ts deleted file mode 100644 index 53f9df3a..00000000 --- a/ClientApp/app/models/User.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface IUser { - id: number; - name: string; -} \ No newline at end of file diff --git a/ClientApp/app/shared/user.service.ts b/ClientApp/app/shared/user.service.ts deleted file mode 100644 index 8bcc3bb3..00000000 --- a/ClientApp/app/shared/user.service.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { Injectable, Inject } from '@angular/core'; -import { Http, URLSearchParams } from '@angular/http'; -import { APP_BASE_HREF } from '@angular/common'; -import { ORIGIN_URL } from './constants/baseurl.constants'; -import { IUser } from '../models/User'; -import { TransferHttp } from '../../modules/transfer-http/transfer-http'; -import { Observable } from 'rxjs/Observable'; - -@Injectable() -export class UserService { - constructor( - private transferHttp: TransferHttp, // Use only for GETS that you want re-used between Server render -> Client render - private http: Http, // Use for everything else - @Inject(ORIGIN_URL) private baseUrl: string) { - - } - - getUsers(): Observable<IUser[]> { - // ** TransferHttp example / concept ** - // - Here we make an Http call on the server, save the result on the window object and pass it down with the SSR, - // The Client then re-uses this Http result instead of hitting the server again! - - // NOTE : transferHttp also automatically does .map(res => res.json()) for you, so no need for these calls - return this.transferHttp.get(`${this.baseUrl}/api/users`); - } - - getUser(user: IUser): Observable<IUser> { - return this.transferHttp.get(`${this.baseUrl}/api/users/` + user.id); - } - - deleteUser(user: IUser): Observable<any> { - return this.http.delete(`${this.baseUrl}/api/users/` + user.id); - } - - updateUser(user: IUser): Observable<any> { - return this.http.put(`${this.baseUrl}/api/users/` + user.id, user); - } - - addUser(newUserName: string): Observable<any> { - return this.http.post(`${this.baseUrl}/api/users`, { name: newUserName }) - } -} diff --git a/Server/Data/DbInitializer.cs b/Server/Data/DbInitializer.cs deleted file mode 100644 index bca0eed3..00000000 --- a/Server/Data/DbInitializer.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Linq; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using AspCoreServer.Models; -using AspCoreServer; - -namespace AspCoreServer.Data -{ - public static class DbInitializer - { - public static void Initialize(SpaDbContext context) - { - context.Database.EnsureCreated(); - - if (context.User.Any()) - { - return; // DB has been seeded - } - var users = new User[] - { - new User(){Name = "Mark Pieszak"}, - new User(){Name = "Abrar Jahin"}, - new User(){Name = "hakonamatata"}, - new User(){Name = "LiverpoolOwen"}, - new User(){Name = "Ketrex"}, - new User(){Name = "markwhitfeld"}, - new User(){Name = "daveo1001"}, - new User(){Name = "paonath"}, - new User(){Name = "nalex095"}, - new User(){Name = "ORuban"}, - new User(){Name = "Gaulomatic"} - }; - - foreach (User s in users) - { - context.User.Add(s); - } - context.SaveChanges(); - } - } -} diff --git a/Server/Data/SpaDbContext.cs b/Server/Data/SpaDbContext.cs deleted file mode 100644 index e6fee5f7..00000000 --- a/Server/Data/SpaDbContext.cs +++ /dev/null @@ -1,17 +0,0 @@ -using AspCoreServer.Models; -using Microsoft.EntityFrameworkCore; - -namespace AspCoreServer.Data -{ - public class SpaDbContext : DbContext - { - public SpaDbContext(DbContextOptions<SpaDbContext> options) - : base(options) - { - Database.EnsureCreated(); - } - - //List of DB Models - Add your DB models here - public DbSet<User> User { get; set; } - } -} diff --git a/Server/Models/User.cs b/Server/Models/User.cs deleted file mode 100644 index fb3d74da..00000000 --- a/Server/Models/User.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; - -namespace AspCoreServer.Models -{ - public class User - { - public int ID { get; set; } - public string Name { get; set; } - - [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)] - [DataType(DataType.Date)] - public DateTime EntryTime { get; set; } - - //Setting Default value - public User() - { - EntryTime = DateTime.Now; - } - } -} diff --git a/Server/RestAPI/UsersController.cs b/Server/RestAPI/UsersController.cs deleted file mode 100644 index 2938eb8e..00000000 --- a/Server/RestAPI/UsersController.cs +++ /dev/null @@ -1,123 +0,0 @@ -using AspCoreServer.Data; -using AspCoreServer.Models; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using System; -using System.Linq; -using System.Threading.Tasks; - -namespace AspCoreServer.Controllers -{ - [Route("api/[controller]")] - public class UsersController : Controller - { - private readonly SpaDbContext _context; - - public UsersController(SpaDbContext context) - { - _context = context; - } - - [HttpGet] - public async Task<IActionResult> Get(int currentPageNo = 1, int pageSize = 20) - { - var users = await _context.User - .OrderByDescending(u => u.EntryTime) - .Skip((currentPageNo - 1) * pageSize) - .Take(pageSize) - .ToArrayAsync(); - - if (!users.Any()) - { - return NotFound("Users not Found"); - } - else - { - return Ok(users); - } - } - - [HttpGet("{id}")] - public async Task<IActionResult> Get(int id) - { - var user = await _context.User - .Where(u => u.ID == id) - .AsNoTracking() - .SingleOrDefaultAsync(m => m.ID == id); - - if (user == null) - { - return NotFound("User not Found"); - } - else - { - return Ok(user); - } - } - - [HttpPost] - public async Task<IActionResult> Post([FromBody]User user) - { - if (!string.IsNullOrEmpty(user.Name)) - { - _context.Add(user); - await _context.SaveChangesAsync(); - return CreatedAtAction("Post", user); - } - else - { - return BadRequest("User's name was not given"); - } - } - - [HttpPut("{id}")] - public async Task<IActionResult> Put(int id, [FromBody]User userUpdateValue) - { - try - { - userUpdateValue.EntryTime = DateTime.Now; - - var userToEdit = await _context.User - .AsNoTracking() - .SingleOrDefaultAsync(m => m.ID == id); - - if (userToEdit == null) - { - return NotFound("Could not update user as it was not Found"); - } - else - { - _context.Update(userUpdateValue); - await _context.SaveChangesAsync(); - return Ok("Updated user - " + userUpdateValue.Name); - } - } - catch (DbUpdateException) - { - //Log the error (uncomment ex variable name and write a log.) - ModelState.AddModelError("", "Unable to save changes. " + - "Try again, and if the problem persists, " + - "see your system administrator."); - return NotFound("User not Found"); - } - } - - [HttpDelete("{id}")] - public async Task<IActionResult> Delete(int id) - { - var userToRemove = await _context.User - .AsNoTracking() - .SingleOrDefaultAsync(m => m.ID == id); - if (userToRemove == null) - { - return NotFound("Could not delete user as it was not Found"); - } - else - { - _context.User.Remove(userToRemove); - await _context.SaveChangesAsync(); - return Ok("Deleted user - " + userToRemove.Name); - } - } - } -} diff --git a/Startup.cs b/Startup.cs index 7736f9e9..2a5b4feb 100644 --- a/Startup.cs +++ b/Startup.cs @@ -7,7 +7,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.EntityFrameworkCore; -using AspCoreServer.Data; using Swashbuckle.AspNetCore.Swagger; namespace AspCoreServer @@ -48,9 +47,6 @@ public void ConfigureServices(IServiceCollection services) var connectionStringBuilder = new Microsoft.Data.Sqlite.SqliteConnectionStringBuilder { DataSource = "spa.db" }; var connectionString = connectionStringBuilder.ToString(); - services.AddDbContext<SpaDbContext>(options => - options.UseSqlite(connectionString)); - // Register the Swagger generator, defining one or more Swagger documents services.AddSwaggerGen(c => { @@ -59,15 +55,13 @@ public void ConfigureServices(IServiceCollection services) } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, SpaDbContext context) + public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseStaticFiles(); - DbInitializer.Initialize(context); - if (env.IsDevelopment()) { app.UseDeveloperExceptionPage();