Remove @mui, move states into zustand store
This commit is contained in:
24
ems/src/api/static/index.ts
Normal file
24
ems/src/api/static/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import express, { Request, Response } from 'express';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
const tileFolder = path.join(__dirname, '..', '..', '..', 'public', 'static')
|
||||
|
||||
router.get('/:city_id', async (req: Request, res: Response) => {
|
||||
const { city_id } = req.params
|
||||
|
||||
const tilePath1 = path.join(tileFolder, `${city_id}.jpg`)
|
||||
const tilePath2 = path.join(tileFolder, `${city_id}.png`)
|
||||
|
||||
if (fs.existsSync(tilePath1)) {
|
||||
return res.sendFile(tilePath1)
|
||||
} else if (fs.existsSync(tilePath2)) {
|
||||
return res.sendFile(tilePath2)
|
||||
} else {
|
||||
res.status(404).send('Tile is not generated or not provided')
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
Reference in New Issue
Block a user