mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-17 05:13:32 +00:00
setup router + tidy up
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
// Create controller for GET request to '/ontime/download'
|
||||
import { db, data } from '../app.js';
|
||||
function getEventTitle() {
|
||||
return data.event.title;
|
||||
}
|
||||
// Returns -
|
||||
export const eventsDownload = async (req, res) => {
|
||||
res.download('db.json', 'ontime events.json', (err) => {
|
||||
export const dbDownload = async (req, res) => {
|
||||
const fileTitle = getEventTitle() || 'ontime events';
|
||||
res.download('db.json', `${fileTitle}.json`, (err) => {
|
||||
if (err) {
|
||||
res.status(500).send({
|
||||
message: 'Could not download the file. ' + err,
|
||||
|
||||
Reference in New Issue
Block a user