16 lines
436 B
JavaScript
16 lines
436 B
JavaScript
const fs = require('fs').promises;
|
|
const path = require('path');
|
|
|
|
const dataPath = path.join(__dirname, '../data/applications.json');
|
|
|
|
const readApplications = async () => {
|
|
const data = await fs.readFile(dataPath, 'utf-8');
|
|
return JSON.parse(data);
|
|
};
|
|
|
|
const writeApplications = async (data) => {
|
|
await fs.writeFile(dataPath, JSON.stringify(data, null, 2), 'utf-8');
|
|
};
|
|
|
|
module.exports = { readApplications, writeApplications };
|