Skip to content

Instantly share code, notes, and snippets.

@nickytoh

nickytoh/Startup.cs

Last active Aug 29, 2015
Embed
What would you like to do?
Super minimal ASP.NET 5 MVC WebApi Project Template!
{
"webroot": "wwwroot",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-beta6",
"Microsoft.AspNet.Hosting": "1.0.0-beta6",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta6"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5001"
}
}
using Microsoft.AspNet.Builder;
using Microsoft.Framework.DependencyInjection;
namespace WebApi
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseMvc();
}
}
}
using Microsoft.AspNet.Mvc;
namespace WebApi
{
[Route("api/[controller]")]
public class UserController: Controller
{
[HttpGet]
public string Get()
{
return "From /api/user";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment