mirror of https://github.com/dotnet/tye.git
Browse Source
* fix #666, enable dotnet watch to refresh on razer file changes * Fix code formatpull/833/head
committed by
GitHub
18 changed files with 373 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
@page |
|||
@model ErrorModel |
|||
@{ |
|||
ViewData["Title"] = "Error"; |
|||
} |
|||
|
|||
<h1 class="text-danger">Error.</h1> |
|||
<h2 class="text-danger">An error occurred while processing your request.</h2> |
|||
|
|||
@if (Model.ShowRequestId) |
|||
{ |
|||
<p> |
|||
<strong>Request ID:</strong> <code>@Model.RequestId</code> |
|||
</p> |
|||
} |
|||
|
|||
<h3>Development Mode</h3> |
|||
<p> |
|||
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred. |
|||
</p> |
|||
<p> |
|||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong> |
|||
It can result in displaying sensitive information from exceptions to end users. |
|||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong> |
|||
and restarting the app. |
|||
</p> |
|||
@ -0,0 +1,27 @@ |
|||
using System.Diagnostics; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace web_app.Pages |
|||
{ |
|||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] |
|||
public class ErrorModel : PageModel |
|||
{ |
|||
public string RequestId { get; set; } |
|||
|
|||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); |
|||
|
|||
private readonly ILogger<ErrorModel> _logger; |
|||
|
|||
public ErrorModel(ILogger<ErrorModel> logger) |
|||
{ |
|||
_logger = logger; |
|||
} |
|||
|
|||
public void OnGet() |
|||
{ |
|||
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
@page |
|||
@model IndexModel |
|||
@{ |
|||
ViewData["Title"] = "Home page"; |
|||
} |
|||
|
|||
<div class="text-center"> |
|||
<h1 class="display-4">Welcome</h1> |
|||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p> |
|||
</div> |
|||
@ -0,0 +1,25 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using Microsoft.AspNetCore.Mvc.RazorPages; |
|||
using Microsoft.Extensions.Logging; |
|||
|
|||
namespace web_app.Pages |
|||
{ |
|||
public class IndexModel : PageModel |
|||
{ |
|||
private readonly ILogger<IndexModel> _logger; |
|||
|
|||
public IndexModel(ILogger<IndexModel> logger) |
|||
{ |
|||
_logger = logger; |
|||
} |
|||
|
|||
public void OnGet() |
|||
{ |
|||
|
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="en"> |
|||
<head> |
|||
<meta charset="utf-8" /> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|||
<title>@ViewData["Title"] - web_app</title> |
|||
<link rel="stylesheet" href="~/css/site.css" /> |
|||
</head> |
|||
<body> |
|||
|
|||
<div> |
|||
<main role="main"> |
|||
@RenderBody() |
|||
</main> |
|||
</div> |
|||
|
|||
<footer class="border-top footer text-muted"> |
|||
<div> |
|||
© 2020 - web_app |
|||
</div> |
|||
</footer> |
|||
|
|||
@RenderSection("Scripts", required: false) |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,3 @@ |
|||
@using web_app |
|||
@namespace web_app.Pages |
|||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |
|||
@ -0,0 +1,3 @@ |
|||
@{ |
|||
Layout = "_Layout"; |
|||
} |
|||
@ -0,0 +1,20 @@ |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace web_app |
|||
{ |
|||
public class Program |
|||
{ |
|||
public static void Main(string[] args) |
|||
{ |
|||
CreateHostBuilder(args).Build().Run(); |
|||
} |
|||
|
|||
public static IHostBuilder CreateHostBuilder(string[] args) => |
|||
Host.CreateDefaultBuilder(args) |
|||
.ConfigureWebHostDefaults(webBuilder => |
|||
{ |
|||
webBuilder.UseStartup<Startup>(); |
|||
}); |
|||
} |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
{ |
|||
"iisSettings": { |
|||
"windowsAuthentication": false, |
|||
"anonymousAuthentication": true, |
|||
"iisExpress": { |
|||
"applicationUrl": "http://localhost:19132", |
|||
"sslPort": 44328 |
|||
} |
|||
}, |
|||
"profiles": { |
|||
"IIS Express": { |
|||
"commandName": "IISExpress", |
|||
"launchBrowser": true, |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
}, |
|||
"web_app": { |
|||
"commandName": "Project", |
|||
"launchBrowser": true, |
|||
"applicationUrl": "https://localhost:5001;http://localhost:5000", |
|||
"environmentVariables": { |
|||
"ASPNETCORE_ENVIRONMENT": "Development" |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,50 @@ |
|||
using Microsoft.AspNetCore.Builder; |
|||
using Microsoft.AspNetCore.Hosting; |
|||
using Microsoft.Extensions.Configuration; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Microsoft.Extensions.Hosting; |
|||
|
|||
namespace web_app |
|||
{ |
|||
public class Startup |
|||
{ |
|||
public Startup(IConfiguration configuration) |
|||
{ |
|||
Configuration = configuration; |
|||
} |
|||
|
|||
public IConfiguration Configuration { get; } |
|||
|
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
|||
public void ConfigureServices(IServiceCollection services) |
|||
{ |
|||
services.AddRazorPages(); |
|||
} |
|||
|
|||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|||
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.
|
|||
app.UseHsts(); |
|||
} |
|||
|
|||
app.UseStaticFiles(); |
|||
|
|||
app.UseRouting(); |
|||
|
|||
app.UseAuthorization(); |
|||
|
|||
app.UseEndpoints(endpoints => |
|||
{ |
|||
endpoints.MapRazorPages(); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,9 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
{ |
|||
"Logging": { |
|||
"LogLevel": { |
|||
"Default": "Information", |
|||
"Microsoft": "Warning", |
|||
"Microsoft.Hosting.Lifetime": "Information" |
|||
} |
|||
}, |
|||
"AllowedHosts": "*" |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
# tye application configuration file |
|||
# read all about it at https://github.com/dotnet/tye |
|||
# |
|||
# when you've given us a try, we'd love to know what you think: |
|||
# https://aka.ms/AA7q20u |
|||
# |
|||
name: web-app |
|||
services: |
|||
- name: web-app |
|||
project: web-app.csproj |
|||
@ -0,0 +1,8 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFramework>netcoreapp3.1</TargetFramework> |
|||
<RootNamespace>web_app</RootNamespace> |
|||
</PropertyGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,71 @@ |
|||
/* Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification |
|||
for details on configuring this project to bundle and minify static web assets. */ |
|||
|
|||
a.navbar-brand { |
|||
white-space: normal; |
|||
text-align: center; |
|||
word-break: break-all; |
|||
} |
|||
|
|||
/* Provide sufficient contrast against white background */ |
|||
a { |
|||
color: #0366d6; |
|||
} |
|||
|
|||
.btn-primary { |
|||
color: #fff; |
|||
background-color: #1b6ec2; |
|||
border-color: #1861ac; |
|||
} |
|||
|
|||
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { |
|||
color: #fff; |
|||
background-color: #1b6ec2; |
|||
border-color: #1861ac; |
|||
} |
|||
|
|||
/* Sticky footer styles |
|||
-------------------------------------------------- */ |
|||
html { |
|||
font-size: 14px; |
|||
} |
|||
@media (min-width: 768px) { |
|||
html { |
|||
font-size: 16px; |
|||
} |
|||
} |
|||
|
|||
.border-top { |
|||
border-top: 1px solid #e5e5e5; |
|||
} |
|||
.border-bottom { |
|||
border-bottom: 1px solid #e5e5e5; |
|||
} |
|||
|
|||
.box-shadow { |
|||
box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .05); |
|||
} |
|||
|
|||
button.accept-policy { |
|||
font-size: 1rem; |
|||
line-height: inherit; |
|||
} |
|||
|
|||
/* Sticky footer styles |
|||
-------------------------------------------------- */ |
|||
html { |
|||
position: relative; |
|||
min-height: 100%; |
|||
} |
|||
|
|||
body { |
|||
/* Margin bottom by footer height */ |
|||
margin-bottom: 60px; |
|||
} |
|||
.footer { |
|||
position: absolute; |
|||
bottom: 0; |
|||
width: 100%; |
|||
white-space: nowrap; |
|||
line-height: 60px; /* Vertically center the text there */ |
|||
} |
|||
|
After Width: | Height: | Size: 31 KiB |
Loading…
Reference in new issue