diff --git a/package.json b/package.json index c485f044..166a51b9 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,6 @@ "version": "0.0.1", "description": "Leaflet Osmand React ExpressJS Coordinates (X)\r > Remember an \"X\" marks the spot.", "main": "index.js", - "type": "module", "scripts": { "clean": "rm -rf dist/*", "build": "rm -rf dist/* && npx tsc && cp -R httpdocs/ dist/", diff --git a/src/app.ts b/src/app.ts index a2daf093..9537cc7b 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,11 +1,7 @@ import express from 'express'; import { Request, Response } from 'express'; import fs from 'fs'; -import { fileURLToPath } from 'url'; -import { dirname, join } from 'path'; - -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); +import path from 'path'; const app = express(); const port = 80; @@ -16,7 +12,8 @@ app.get('/', (req: Request, res: Response) => { app.listen(port, () => { const date = new Date().toLocaleString('de-DE', { hour12: false }); - const logPath = join(__dirname, 'httpdocs', 'log.txt'); + const logPath = path.join(__dirname, 'httpdocs', 'log.txt'); fs.appendFileSync(logPath, `Express: Server: ${date} \n`); + console.log(`Server läuft unter http://localhost:${port}`); -}); \ No newline at end of file +}); diff --git a/tsconfig.json b/tsconfig.json index 7a568e39..19cde211 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,11 +3,11 @@ "include": ["src/**/*"], "exclude": ["node_modules"], "compilerOptions": { - "rootDir": "src", - "outDir": "dist", - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022", - "sourceMap": true + "rootDir": "src", + "outDir": "dist", + "module": "CommonJS", + "moduleResolution": "node", + "target": "ES6", + "sourceMap": true } } \ No newline at end of file