You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
650 B
26 lines
650 B
7 years ago
|
import { EXPORTED_PATH } from '../config'
|
||
|
|
||
|
import * as express from 'express'
|
||
|
import * as fs from 'fs'
|
||
|
import * as path from 'path'
|
||
|
|
||
|
|
||
|
async function deleteTask(req, res) {
|
||
|
let filename = req.query.filename;
|
||
|
let csvFilePath = path.join(EXPORTED_PATH, `${filename}.csv`);
|
||
|
let jsonFilePath = path.join(EXPORTED_PATH, `${filename}.json`);
|
||
|
|
||
|
if(fs.existsSync(csvFilePath)) {
|
||
|
fs.unlink(csvFilePath, err => console.error(err));
|
||
|
}
|
||
|
if(fs.existsSync(jsonFilePath)) {
|
||
|
fs.unlink(jsonFilePath, err => console.error(err));
|
||
|
}
|
||
|
|
||
|
res.status(200).send({ status: 'OK' });
|
||
|
}
|
||
|
|
||
|
export const router = express.Router();
|
||
|
|
||
|
router.get('/', deleteTask);
|