mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Normalise line endings
This commit is contained in:
@@ -1,17 +1,17 @@
|
|||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
namespace MusicStore.Controllers
|
namespace MusicStore.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View("~/Views/Shared/Error.cshtml");
|
return View("~/Views/Shared/Error.cshtml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,130 +1,130 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.AspNet.Authorization;
|
using Microsoft.AspNet.Authorization;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Hosting;
|
using Microsoft.AspNet.Hosting;
|
||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
using Microsoft.Data.Entity;
|
using Microsoft.Data.Entity;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.PlatformAbstractions;
|
using Microsoft.Extensions.PlatformAbstractions;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using MusicStore.Apis;
|
using MusicStore.Apis;
|
||||||
using MusicStore.Models;
|
using MusicStore.Models;
|
||||||
|
|
||||||
namespace MusicStore
|
namespace MusicStore
|
||||||
{
|
{
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
||||||
{
|
{
|
||||||
// Setup configuration sources.
|
// Setup configuration sources.
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(appEnv.ApplicationBasePath)
|
.SetBasePath(appEnv.ApplicationBasePath)
|
||||||
.AddJsonFile("appsettings.json")
|
.AddJsonFile("appsettings.json")
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
Configuration = builder.Build();
|
Configuration = builder.Build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IConfigurationRoot Configuration { get; set; }
|
public IConfigurationRoot Configuration { get; set; }
|
||||||
|
|
||||||
// This method gets called by the runtime.
|
// This method gets called by the runtime.
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
services.Configure<SiteSettings>(settings =>
|
services.Configure<SiteSettings>(settings =>
|
||||||
{
|
{
|
||||||
settings.DefaultAdminUsername = Configuration["DefaultAdminUsername"];
|
settings.DefaultAdminUsername = Configuration["DefaultAdminUsername"];
|
||||||
settings.DefaultAdminPassword = Configuration["DefaultAdminPassword"];
|
settings.DefaultAdminPassword = Configuration["DefaultAdminPassword"];
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add MVC services to the services container.
|
// Add MVC services to the services container.
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
|
|
||||||
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
|
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
|
||||||
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
|
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
|
||||||
// services.AddWebApiConventions();
|
// services.AddWebApiConventions();
|
||||||
|
|
||||||
// Add EF services to the service container
|
// Add EF services to the service container
|
||||||
services.AddEntityFramework()
|
services.AddEntityFramework()
|
||||||
.AddSqlite()
|
.AddSqlite()
|
||||||
.AddDbContext<MusicStoreContext>(options => {
|
.AddDbContext<MusicStoreContext>(options => {
|
||||||
options.UseSqlite(Configuration["DbConnectionString"]);
|
options.UseSqlite(Configuration["DbConnectionString"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add Identity services to the services container
|
// Add Identity services to the services container
|
||||||
services.AddIdentity<ApplicationUser, IdentityRole>()
|
services.AddIdentity<ApplicationUser, IdentityRole>()
|
||||||
.AddEntityFrameworkStores<MusicStoreContext>()
|
.AddEntityFrameworkStores<MusicStoreContext>()
|
||||||
.AddDefaultTokenProviders();
|
.AddDefaultTokenProviders();
|
||||||
|
|
||||||
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
|
// Uncomment the following line to add Web API services which makes it easier to port Web API 2 controllers.
|
||||||
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
|
// You will also need to add the Microsoft.AspNet.Mvc.WebApiCompatShim package to the 'dependencies' section of project.json.
|
||||||
// services.AddWebApiConventions();
|
// services.AddWebApiConventions();
|
||||||
|
|
||||||
// Configure Auth
|
// Configure Auth
|
||||||
services.Configure<AuthorizationOptions>(options =>
|
services.Configure<AuthorizationOptions>(options =>
|
||||||
{
|
{
|
||||||
options.AddPolicy("app-ManageStore", new AuthorizationPolicyBuilder().RequireClaim("app-ManageStore", "Allowed").Build());
|
options.AddPolicy("app-ManageStore", new AuthorizationPolicyBuilder().RequireClaim("app-ManageStore", "Allowed").Build());
|
||||||
});
|
});
|
||||||
|
|
||||||
Mapper.CreateMap<AlbumChangeDto, Album>();
|
Mapper.CreateMap<AlbumChangeDto, Album>();
|
||||||
Mapper.CreateMap<Album, AlbumChangeDto>();
|
Mapper.CreateMap<Album, AlbumChangeDto>();
|
||||||
Mapper.CreateMap<Album, AlbumResultDto>();
|
Mapper.CreateMap<Album, AlbumResultDto>();
|
||||||
Mapper.CreateMap<AlbumResultDto, Album>();
|
Mapper.CreateMap<AlbumResultDto, Album>();
|
||||||
Mapper.CreateMap<Artist, ArtistResultDto>();
|
Mapper.CreateMap<Artist, ArtistResultDto>();
|
||||||
Mapper.CreateMap<ArtistResultDto, Artist>();
|
Mapper.CreateMap<ArtistResultDto, Artist>();
|
||||||
Mapper.CreateMap<Genre, GenreResultDto>();
|
Mapper.CreateMap<Genre, GenreResultDto>();
|
||||||
Mapper.CreateMap<GenreResultDto, Genre>();
|
Mapper.CreateMap<GenreResultDto, Genre>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure is called after ConfigureServices is called.
|
// Configure is called after ConfigureServices is called.
|
||||||
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
|
||||||
{
|
{
|
||||||
// Initialize the sample data
|
// Initialize the sample data
|
||||||
SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait();
|
SampleData.InitializeMusicStoreDatabaseAsync(app.ApplicationServices).Wait();
|
||||||
|
|
||||||
loggerFactory.MinimumLevel = LogLevel.Warning;
|
loggerFactory.MinimumLevel = LogLevel.Warning;
|
||||||
loggerFactory.AddConsole();
|
loggerFactory.AddConsole();
|
||||||
loggerFactory.AddDebug();
|
loggerFactory.AddDebug();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|
||||||
// Add the platform handler to the request pipeline.
|
// Add the platform handler to the request pipeline.
|
||||||
app.UseIISPlatformHandler();
|
app.UseIISPlatformHandler();
|
||||||
|
|
||||||
// Add the following to the request pipeline only in development environment.
|
// Add the following to the request pipeline only in development environment.
|
||||||
if (env.IsDevelopment())
|
if (env.IsDevelopment())
|
||||||
{
|
{
|
||||||
app.UseDeveloperExceptionPage();
|
app.UseDeveloperExceptionPage();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Add Error handling middleware which catches all application specific errors and
|
// Add Error handling middleware which catches all application specific errors and
|
||||||
// send the request to the following path or controller action.
|
// send the request to the following path or controller action.
|
||||||
app.UseExceptionHandler("/Home/Error");
|
app.UseExceptionHandler("/Home/Error");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add static files to the request pipeline.
|
// Add static files to the request pipeline.
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles();
|
||||||
|
|
||||||
// Add MVC to the request pipeline.
|
// Add MVC to the request pipeline.
|
||||||
app.UseMvc(routes =>
|
app.UseMvc(routes =>
|
||||||
{
|
{
|
||||||
// Matches requests that correspond to an existent controller/action pair
|
// Matches requests that correspond to an existent controller/action pair
|
||||||
routes.MapRoute("default", "{controller}/{action}/{id:int?}");
|
routes.MapRoute("default", "{controller}/{action}/{id:int?}");
|
||||||
|
|
||||||
// Matches any other request that doesn't appear to have a filename extension (defined as 'having a dot in the last URI segment').
|
// Matches any other request that doesn't appear to have a filename extension (defined as 'having a dot in the last URI segment').
|
||||||
// This means you'll correctly get 404s for /some/dir/non-existent-image.png instead of returning the SPA HTML.
|
// This means you'll correctly get 404s for /some/dir/non-existent-image.png instead of returning the SPA HTML.
|
||||||
// However, it means requests like /customers/isaac.newton will *not* be mapped into the SPA, so if you need to accept
|
// However, it means requests like /customers/isaac.newton will *not* be mapped into the SPA, so if you need to accept
|
||||||
// URIs like that you'll need to match all URIs, e.g.:
|
// URIs like that you'll need to match all URIs, e.g.:
|
||||||
// routes.MapRoute("spa-fallback", "{*anything}", new { controller = "Home", action = "Index" });
|
// routes.MapRoute("spa-fallback", "{*anything}", new { controller = "Home", action = "Index" });
|
||||||
// (which of course will match /customers/isaac.png too, so in that case it would serve the PNG image at that URL if one is on disk,
|
// (which of course will match /customers/isaac.png too, so in that case it would serve the PNG image at that URL if one is on disk,
|
||||||
// or the SPA HTML if not).
|
// or the SPA HTML if not).
|
||||||
routes.MapSpaFallbackRoute("spa-fallback", new { controller = "Home", action = "Index" });
|
routes.MapSpaFallbackRoute("spa-fallback", new { controller = "Home", action = "Index" });
|
||||||
|
|
||||||
// Uncomment the following line to add a route for porting Web API 2 controllers.
|
// Uncomment the following line to add a route for porting Web API 2 controllers.
|
||||||
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
|
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
108
samples/angular/MusicStore/gulpfile.js
vendored
108
samples/angular/MusicStore/gulpfile.js
vendored
@@ -1,54 +1,54 @@
|
|||||||
/// <binding AfterBuild='build' Clean='clean' />
|
/// <binding AfterBuild='build' Clean='clean' />
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var gulp = require('gulp');
|
var gulp = require('gulp');
|
||||||
var del = require('del');
|
var del = require('del');
|
||||||
var typescript = require('gulp-typescript');
|
var typescript = require('gulp-typescript');
|
||||||
var inlineNg2Template = require('gulp-inline-ng2-template');
|
var inlineNg2Template = require('gulp-inline-ng2-template');
|
||||||
var sourcemaps = require('gulp-sourcemaps');
|
var sourcemaps = require('gulp-sourcemaps');
|
||||||
|
|
||||||
var project = require("./project.json");
|
var project = require("./project.json");
|
||||||
var webroot = "./" + project.webroot + "/";
|
var webroot = "./" + project.webroot + "/";
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
libBase: 'node_modules',
|
libBase: 'node_modules',
|
||||||
lib: [
|
lib: [
|
||||||
require.resolve('bootstrap/dist/css/bootstrap.css'),
|
require.resolve('bootstrap/dist/css/bootstrap.css'),
|
||||||
path.dirname(require.resolve('bootstrap/dist/fonts/glyphicons-halflings-regular.woff')) + '/**',
|
path.dirname(require.resolve('bootstrap/dist/fonts/glyphicons-halflings-regular.woff')) + '/**',
|
||||||
require.resolve('angular2/bundles/angular2-polyfills.js'),
|
require.resolve('angular2/bundles/angular2-polyfills.js'),
|
||||||
require.resolve('traceur/bin/traceur-runtime.js'),
|
require.resolve('traceur/bin/traceur-runtime.js'),
|
||||||
require.resolve('es6-module-loader/dist/es6-module-loader-sans-promises.js'),
|
require.resolve('es6-module-loader/dist/es6-module-loader-sans-promises.js'),
|
||||||
require.resolve('systemjs/dist/system.src.js'),
|
require.resolve('systemjs/dist/system.src.js'),
|
||||||
require.resolve('angular2/bundles/angular2.dev.js'),
|
require.resolve('angular2/bundles/angular2.dev.js'),
|
||||||
require.resolve('angular2/bundles/router.dev.js'),
|
require.resolve('angular2/bundles/router.dev.js'),
|
||||||
require.resolve('angular2/bundles/http.dev.js'),
|
require.resolve('angular2/bundles/http.dev.js'),
|
||||||
require.resolve('angular2-aspnet/bundles/angular2-aspnet.js'),
|
require.resolve('angular2-aspnet/bundles/angular2-aspnet.js'),
|
||||||
require.resolve('jquery/dist/jquery.js'),
|
require.resolve('jquery/dist/jquery.js'),
|
||||||
require.resolve('bootstrap/dist/js/bootstrap.js'),
|
require.resolve('bootstrap/dist/js/bootstrap.js'),
|
||||||
require.resolve('rxjs/bundles/Rx.js')
|
require.resolve('rxjs/bundles/Rx.js')
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
gulp.task('build.lib', function () {
|
gulp.task('build.lib', function () {
|
||||||
return gulp.src(config.lib, { base: config.libBase })
|
return gulp.src(config.lib, { base: config.libBase })
|
||||||
.pipe(gulp.dest(webroot + 'lib'));
|
.pipe(gulp.dest(webroot + 'lib'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('build', ['build.lib'], function () {
|
gulp.task('build', ['build.lib'], function () {
|
||||||
var tsProject = typescript.createProject('./tsconfig.json', { typescript: require('typescript') });
|
var tsProject = typescript.createProject('./tsconfig.json', { typescript: require('typescript') });
|
||||||
var tsSrcInlined = gulp.src([webroot + '**/*.ts'], { base: webroot })
|
var tsSrcInlined = gulp.src([webroot + '**/*.ts'], { base: webroot })
|
||||||
.pipe(inlineNg2Template({ base: webroot }));
|
.pipe(inlineNg2Template({ base: webroot }));
|
||||||
return tsSrcInlined
|
return tsSrcInlined
|
||||||
.pipe(sourcemaps.init())
|
.pipe(sourcemaps.init())
|
||||||
.pipe(typescript(tsProject))
|
.pipe(typescript(tsProject))
|
||||||
.pipe(sourcemaps.write())
|
.pipe(sourcemaps.write())
|
||||||
.pipe(gulp.dest(webroot));
|
.pipe(gulp.dest(webroot));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('clean', function () {
|
gulp.task('clean', function () {
|
||||||
return del([webroot + 'lib']);
|
return del([webroot + 'lib']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['build']);
|
gulp.task('default', ['build']);
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
namespace ES2015Example.Controllers
|
namespace ES2015Example.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index(int pageIndex)
|
public IActionResult Index(int pageIndex)
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View("~/Views/Shared/Error.cshtml");
|
return View("~/Views/Shared/Error.cshtml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
using Microsoft.AspNet.Mvc;
|
using Microsoft.AspNet.Mvc;
|
||||||
|
|
||||||
namespace ReactExample.Controllers
|
namespace ReactExample.Controllers
|
||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
{
|
{
|
||||||
return View("~/Views/Shared/Error.cshtml");
|
return View("~/Views/Shared/Error.cshtml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user