refactor: serve static files from a dedicated directory
This commit is contained in:
parent
be6d378890
commit
299b8c1404
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "calendar-merger",
|
"name": "calendar-merger",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "calendar-merger",
|
"name": "calendar-merger",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.7.7",
|
"axios": "^1.7.7",
|
||||||
|
|
|
@ -13,9 +13,8 @@ console.log(`Merged calendars directory: ${MERGED_CALENDARS_DIR} under ${process
|
||||||
// Ensure the merged calendars directory exists
|
// Ensure the merged calendars directory exists
|
||||||
fs.mkdirSync(MERGED_CALENDARS_DIR, { recursive: true });
|
fs.mkdirSync(MERGED_CALENDARS_DIR, { recursive: true });
|
||||||
|
|
||||||
// Serve static files
|
// Serve static files from the 'public' directory
|
||||||
app.get('/script.js', (req, res) => res.sendFile('script.js', { root: '.' }));
|
app.use(express.static(path.join(process.cwd(), 'public')));
|
||||||
app.get('/', (req, res) => res.sendFile('index.html', { root: '.' }));
|
|
||||||
|
|
||||||
// Utility to sanitize filenames
|
// Utility to sanitize filenames
|
||||||
const sanitizeFilename = (filename) => filename.replace(/[<>:"/\\|?* ]/g, '_');
|
const sanitizeFilename = (filename) => filename.replace(/[<>:"/\\|?* ]/g, '_');
|
||||||
|
|
Loading…
Reference in New Issue