Seichis / AspNetCoreSpa

Asp.Net Core 2 & Angular (5+) SPA with Angular CLI, Webpack full featured application. Live demo:

Home Page:http://aspnetcorespa.azurewebsites.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build status Build status Join the chat at https://gitter.im/aspnetcorespa/Lobby MIT license

Features

Pre-requisites

  1. .Net core sdk
  2. Either VSCode with C# extension OR Visual studio 2017
  3. Nodejs

**Make sure you have Node version >= latest LTS and NPM >= latest LTS

Installation

1. Clone the repo
    git clone https://github.com/asadsahi/AspNetCoreSpa
2. Change directory
    cd AspNetCoreSpa
3. dotnet restore
4. Install global dependencies
    npm install protractor rimraf http-server @angular/cli -g
5. npm install
6. Two ways to run the app (Development mode):
    i) First: (F5 from VScode or Visual studio IDE):
        F5 (This will automatically launch browser)
    ii) Second: (from command line)
        Dev mode:
        npm run dev:watch
        Browse using http://localhost:5000 or https://localhost:5001 
        Prod mode:
        npm run prod:watch

7. Point to Sqllite or SqlServer
    
This project supports both sql server and sql lite databases

* Run with Sqlite:
    * Project is configured to run with sqlite by default and there is an 'Initial' migration already added (see Migrations folder)
    * After changing you models, you can add additional migrations 
    [see docs](https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet)

* Run with SqlServer:
    * To run under sql server:
        * npm run clean
        * Flip the switch in appsettings.json called `useSqLite` to `false`, this should point to use local sql server setup   as default instance. (See appsettings.json file for connection string)
        * Run `dotnet ef migrations add "InitialMigrationName"`

Other commands

Scaffold Angular components using Angular CLI

Scaffold Usage
Component ng g component my-new-component
Directive ng g directive my-new-directive
Pipe ng g pipe my-new-pipe
Service ng g service my-new-service
Class ng g class my-new-class
Guard ng g guard my-new-guard
Interface ng g interface my-new-interface
Enum ng g enum my-new-enum
Module ng g module my-module

run Angular tests

npm test

Compodoc Angular documentation

  • Steps to generate:
    • npm i compodoc -g
    • npm run compodoc
    • cd documentation
    • http-server

Compodoc documentation: alt text

### run end-to-end tests
```bash
# make sure you have your server running in another terminal (i.e run "dotnet run" command)
npm run e2e

run Protractor's elementExplorer (for end-to-end)

npm run webdriver:start
# in another terminal
npm run e2e:live

Compatability

  • This project is supported in everygreen browsers and IE10+
  • IE8 & IE9 aren't supported since Bootstrap 4 is supported in IE10+ explained here.

Azure Deploy

  • You can set an environment variable for azure app deployment password Set-Item -path env:AzureAppPass -value passwordhere
From powershell:
./deploy-azure.ps1

paypal

About

Asp.Net Core 2 & Angular (5+) SPA with Angular CLI, Webpack full featured application. Live demo:

http://aspnetcorespa.azurewebsites.net/

License:MIT License


Languages

Language:C# 47.8%Language:TypeScript 31.7%Language:JavaScript 12.9%Language:HTML 6.2%Language:CSS 0.8%Language:PowerShell 0.7%