Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade static files sample to 2.x #5606

Closed
peterblazejewicz opened this issue Mar 6, 2018 · 9 comments
Closed

Upgrade static files sample to 2.x #5606

peterblazejewicz opened this issue Mar 6, 2018 · 9 comments
Milestone

Comments

@peterblazejewicz
Copy link
Contributor

  1. Write a short paragraph describing what the topic will cover.

I'd like to ask for update of sample content available here:
https://github.com/aspnet/Docs/tree/master/aspnetcore/fundamentals/static-files/samples

to cover version 2.*.

The docs discussing the content in subject are here:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?tabs=aspnetcore2x

I've found that most of the content related to static, simple web site with dotnet are now outdated as they cover version 1.*, so it would be nice to have that sample upgraded.

Thanks!

@Rick-Anderson
Copy link
Contributor

What in the document is out of date for 2.0?

@Rick-Anderson Rick-Anderson added this to the Backlog milestone Mar 7, 2018
@guardrex
Copy link
Collaborator

guardrex commented Mar 7, 2018

Could probably call this a dup ... this one is on the tracking issue for update: #5495 Yes, @peterblazejewicz, it's going to get the "full treatment" 😄 lol, including the updates for 2.1.

@Rick-Anderson
Copy link
Contributor

dup of #5495

@peterblazejewicz
Copy link
Contributor Author

Hi folks,
Sorry for late reply.
You're discussing docs. I read the docs and I know there are sections for 2.0/1.0 (maybe not yet for 2.1).
I've asked to update source file in this repo samples folder: Upgrade static files sample to 2.x
I could do this myself. The dup linked issue deals with .md files unless I'm wrong (that is directly discuss docs update)
Thanks!

@guardrex
Copy link
Collaborator

guardrex commented Mar 8, 2018

@peterblazejewicz #5495 deals with the sample updates, and this one is on the list. We're probably going to bypass taking it to 2.0 and roll in the 2.1 updates as well. Also, this sample isn't a Razor Pages sample, and it will likely become a Razor Pages app when it's upgraded.

@peterblazejewicz
Copy link
Contributor Author

@guardrex

this sample isn't a Razor Pages sample, and it will likely become a Razor Pages app when it's upgraded.

Can we keep the server simple and nimble? And be able to serve static content first - before using heavy gun like Razor pages. I'd like to be able to just setup a static page (say on single chip, $5 computer, just html hosting page and javascript for client application).
Thanks for the answer, appreciated!

@guardrex
Copy link
Collaborator

guardrex commented Mar 8, 2018

@peterblazejewicz Yes, I see what you mean. Absolutely, yes! ...

Just start with an empty web starter template and add in the Static File Middleware as described in the topic.

That empty web starter project doesn't have MVC or Razor Pages bits ... it's just bare bones. It only writes a "Hello World!" out.

If you want to see the template for it in the GitHub repo, it's here 👉 https://github.com/aspnet/templating/tree/dev/src/Microsoft.DotNet.Web.ProjectTemplates/content/EmptyWeb-CSharp ... take a look at the Startup class, and you'll see what I mean.

If you want to generate that project locally, you can use Visual Studio and select the empty ASP.NET Core web starter template for a new project. If you're not using Visual Studio, run dotnet new web from a command prompt in an empty folder. If you want to see all of the templates it can create, type dotnet new --help. The doc is here 👉 https://docs.microsoft.com/dotnet/core/tools/dotnet-new?tabs=netcore2x

Then, just add the Static File Middleware with app.UseStaticFiles(); to the Configure method as described in https://docs.microsoft.com/aspnet/core/fundamentals/static-files?tabs=aspnetcore2x.

We also have some nice content over in the Hosting topic ... especially the beginning, where it talks about creating a web host: https://docs.microsoft.com/aspnet/core/fundamentals/hosting?tabs=aspnetcore2x ... that will help you understand what CreateDefaultBuilder in the Program class is setting up behind-the-scenes.

I'm going to note our discussion here over in the tracking issue. When that whole topic (and the sample) is updated, the author might be able to address your scenario by stating that Static File Middleware can be used independently of other middlewares, MVC, and Razor Pages.

@peterblazejewicz
Copy link
Contributor Author

Awesome, that's really helpful!

@guardrex
Copy link
Collaborator

guardrex commented Mar 8, 2018

Sure thing ... glad I could help. If you need to chat with devs about ASP.NET Core, many devs hang out on the ASP.NET Core Slack channel. The self-signup is here: http://tattoocoder.com/aspnet-slack-sign-up/ ... and there are many channels that pertain to specific areas of ASP.NET Core, but you can ask just about anything in the #general or #aspnet-core chat rooms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants