Skip to content

Commit

Permalink
[Change] #6 revert back to require (#28)
Browse files Browse the repository at this point in the history
* [Task] #6 provide fallback index.html

* [Task] #6 production ready code (m)

move httpdocs folder to dist
have compile without sourcemaps for faster speed

* [Task] #6 create github action for upload when main is updated (#21)

* [change] #6 new ftp upload action

* [Fix] #6 replace host with server in ftp action

* [Task] #6 basic log (#26)

* [CHANGE] #6 revert back to require output for production
  • Loading branch information
Type-Style authored Jan 12, 2024
1 parent 43c1f1d commit 2cafc00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 14 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/",
Expand Down
11 changes: 4 additions & 7 deletions src/app.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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}`);
});
});
12 changes: 6 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 2cafc00

Please sign in to comment.