still figuring out how to handle default note name...
This commit is contained in:
@ -3,6 +3,7 @@ using BinaryDad.Notes.Services;
|
||||
|
||||
namespace BinaryDad.Notes.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
public class ApiController : ControllerBase
|
||||
{
|
||||
private readonly INoteService noteService;
|
||||
@ -12,6 +13,7 @@ namespace BinaryDad.Notes.Controllers
|
||||
this.noteService = noteService;
|
||||
}
|
||||
|
||||
[Route("note/{noteName}")]
|
||||
public string Note(string noteName) => noteService.GetText(noteName);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using BinaryDad.Notes.Models;
|
||||
using BinaryDad.Notes.Models;
|
||||
using BinaryDad.Notes.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@ -15,9 +15,14 @@ public class NoteController : Controller
|
||||
this.noteService = noteService;
|
||||
}
|
||||
|
||||
[Route("{noteName=default}")]
|
||||
[Route("{noteName?}")]
|
||||
public IActionResult Index(string noteName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(noteName))
|
||||
{
|
||||
noteName = "default";
|
||||
}
|
||||
|
||||
var model = new ContentModel
|
||||
{
|
||||
CurrentNote = noteName,
|
||||
|
Reference in New Issue
Block a user