Browse Source

genericize file tx out of project-data folder

master
Rich Brown 1 year ago
parent
commit
9710757c0a
2 changed files with 13 additions and 9 deletions
  1. +6
    -7
      routes/kml-router.js
  2. +7
    -2
      src/index.js

+ 6
- 7
routes/kml-router.js View File

@@ -1,10 +1,9 @@
import express from 'express';
import path from 'path';
// import express from 'express';
// import path from 'path';

export const kmlRouter = express.Router(); //eslint-disable-line
// export const kmlRouter = express.Router(); //eslint-disable-line


kmlRouter.get('/', (req, res) => {
console.log(__dirname);
res.sendFile('benches.kml', { root: path.join(__dirname, '../project-data') });
});
// kmlRouter.get('/', (req, res) => {

// });

+ 7
- 2
src/index.js View File

@@ -1,11 +1,12 @@
import express from 'express';
import cors from 'cors';
import compression from 'compression';
import path from 'path';

import { blogRouter } from '../routes/blog-router';
import { genericRouter } from '../routes/generic-notify';
import { colorRouter } from '../routes/color-router';
import { kmlRouter } from '../routes/kml-router';
// import { kmlRouter } from '../routes/kml-router';

const port = 8086;

@@ -18,7 +19,11 @@ app.use(express.json());
app.use('/blog', blogRouter);
app.use('/generic', genericRouter);
app.use('/color', colorRouter);
app.use('/benches', kmlRouter);
// app.use('/benches', kmlRouter);
app.get('/:filename', (req, res) => {
const { filename } = req.params;
res.sendFile(filename, { root: path.join(__dirname, '../project-data') });
});

app.get('*', (req, res) => res.sendStatus(404));



Loading…
Cancel
Save