I'm working with the ASP.NET core example project. To create the project run
dotnet new lambda.DynamoDBBlogAPI --profile default --region us-east-1
This creates two controllers by default.
- Controllers\S3ProxyController - Web API controller for proxying an S3 bucket
- Controllers\ValuesController - example Web API controller
I'm trying to add an additional controller .. but I'm clearly missing something as the controller does not seem to register.
If I simply add a class that looks like this to the Controllers folder.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.AspNetCore.Mvc;
namespace FriendHelper.Controllers
{
[Route("api/animals")]
class AnimalController : Controller
{
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "Lion", "Tiger" };
}
}
}
This doesn't seem to register, so going to http://localhost:5000/api/animals simply returns a 404
I don't have much experience with ASP.NET MVC so I'm sure there's something silly I'm missing but I can't see where these other controllers are registered.