this repo has no description
at main 360 B view raw
1import path from 'path'; 2import { promises as fs } from 'fs'; 3 4export async function get_data() { 5 const jsonDirectory = path.join(process.cwd(), 'src'); 6 const fileContents = await fs.readFile(jsonDirectory + '/menu.json', 'utf8'); 7 let parsed = {} 8 try { 9 parsed = JSON.parse(fileContents); 10 } catch { 11 parsed = {"err": "no"} 12 } 13 return parsed 14}