Refactor code saving data
Move the code dealing with saving and loading data to server/database to gather it all up into one place.
This commit is contained in:
parent
754d175ce2
commit
6ea3567c94
8 changed files with 64 additions and 58 deletions
|
@ -1,6 +1,5 @@
|
|||
import { readFile } from "node:fs/promises";
|
||||
import { Schedule } from "~/shared/types/schedule";
|
||||
import { readSchedule } from "~/server/database";
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
return JSON.parse(await readFile("schedule.json", "utf-8")) as Schedule;
|
||||
return await readSchedule();
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue