Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

Commit

Permalink
Update/web api app. Closes #692 (#700)
Browse files Browse the repository at this point in the history
* 🎨 Store README.md in project root

The aspnet/Templates creates empty wwwroot web root
directory. This commits brings the same behavior
to generator. The readme is created in project root
while web root folder is created empty

Thanks!

* ⬆️ Update web api template for RC2

Udpated with recent changes from aspnet/Templates.
Tested and run on 1.0.0-preview1-002700

Thanks!
  • Loading branch information
peterblazejewicz committed May 12, 2016
1 parent 2d71b14 commit 3b28476
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 23 deletions.
4 changes: 3 additions & 1 deletion app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var yeoman = require('yeoman-generator');
var yosay = require('yosay');
var chalk = require('chalk');
var mkdirp = require('mkdirp');
var path = require('path');
var guid = require('uuid');
var projectName = require('vs_projectname');
Expand Down Expand Up @@ -201,7 +202,8 @@ var AspnetGenerator = yeoman.generators.Base.extend({
this.fs.copyTpl(this.templatePath('Properties/**/*'), this.applicationName + '/Properties', this.templatedata);
this.fs.copyTpl(this.sourceRoot() + '/Controllers/ValuesController.cs', this.applicationName + '/Controllers/ValuesController.cs', this.templatedata);
this.fs.copy(this.sourceRoot() + '/web.config', this.applicationName + '/web.config');
this.fs.copy(this.templatePath('wwwroot/**/*'), this.applicationName + '/wwwroot');
this.fs.copy(this.sourceRoot() + '/README.md', this.applicationName + '/README.md');
mkdirp.sync(this.applicationName + '/wwwroot');
break;

case 'web':
Expand Down
8 changes: 8 additions & 0 deletions templates/projects/webapi/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:24446/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName" : "IISExpress",
Expand Down
6 changes: 1 addition & 5 deletions templates/projects/webapi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
{
source.Path = "appsettings.json";
source.ReloadOnChange = true;
})
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
Expand Down
28 changes: 12 additions & 16 deletions templates/projects/webapi/project.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-24008",
"version": "1.0.0-rc2-3002611",
"type": "platform"
},
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-20581"
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-20801",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-20801",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-20801",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-20801",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc2-20801",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-20801",
"Microsoft.Extensions.Logging": "1.0.0-rc2-20801",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20801",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-20801"
},

"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-rc2-20581",
"version": "1.0.0-rc2-20801",
"imports": "portable-net45+win8+dnxcore50"
}
},
Expand All @@ -32,7 +32,7 @@
}
},

"compilationOptions": {
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
Expand All @@ -47,10 +47,6 @@
"Views",
"appsettings.json",
"web.config"
],

"exclude": [
"node_modules"
]
},

Expand Down
2 changes: 1 addition & 1 deletion test/test-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,9 @@ describe('aspnet - Web API Application', function() {
'webAPITest/project.json',
'webAPITest/Program.cs',
'webAPITest/Properties/launchSettings.json',
'webAPITest/README.md',
'webAPITest/Startup.cs',
'webAPITest/.gitignore',
'webAPITest/wwwroot/README.md',
'webAPITest/web.config',
'webAPITest/Dockerfile'
];
Expand Down

0 comments on commit 3b28476

Please sign in to comment.