still figuring out how to handle default note name...

This commit is contained in:
Ryan Peters
2023-08-04 18:26:22 -04:00
parent e89f9f74fe
commit 41de9e60c4
5 changed files with 27 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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,