You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
475 B
JavaScript

import fs from 'fs';
export default async function handler(req, res) {
if (process.env.NODE_ENV !== 'development') {
return res.status(401).send('Unauthorized');
}
if (req.method === 'POST') {
try {
fs.copyFileSync('./test-db.sqlite3', './db.sqlite3');
res.status(200).end();
} catch (error) {
console.error(error);
res.status(500).send('Error copying file');
}
} else {
res.status(405).send('Method Not Allowed');
}
}