using Microsoft.AspNetCore.Mvc; namespace BinaryDad.Notes.Controllers; [ApiController] [Route("[controller]")] public class ApiController : ControllerBase { private readonly string filePath; public ApiController(IConfiguration configuration) { filePath = configuration["ContentFilePath"]; } [HttpPost] [Route("save")] public async Task Save() { var content = string.Empty; using (var reader = new StreamReader(Request.Body)) { content = await reader.ReadToEndAsync(); } await System.IO.File.WriteAllTextAsync(filePath, content); return true; } }