website/index.js

24 lines
600 B
JavaScript
Raw Normal View History

2023-12-10 21:31:59 +01:00
import express from "express";
import path from "path";
const app = express();
app.use('/public', express.static('public'))
app.get('/data.json', async (req, res) => {
res.json({
coms: await Bun.file('./_COMMUNES.geojson').json(),
arrs: await Bun.file('./_ARRONDISSEMENTS.geojson').json(),
deps: await Bun.file('./_DEPARTEMENTS.geojson').json(),
});
})
app.get('/map', (req, res) => {
res.sendFile( path.resolve(__dirname, 'map.html') )
})
app.get('/', (req, res) => {
res.sendFile( path.resolve(__dirname, 'index.html') )
})
app.listen(8080, '0.0.0.0');