-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [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)
- Loading branch information
1 parent
f66f835
commit 43c1f1d
Showing
2 changed files
with
14 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,22 @@ | ||
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); | ||
|
||
const app = express(); | ||
const port = 80; | ||
|
||
app.get('/', (req: Request, res: Response) => { | ||
res.send('Hello World, via TypeScript and Node.js!'); | ||
|
||
res.send('Hello World, via TypeScript and Node.js!'); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`Server running at http://localhost:${port}`); | ||
const date = new Date().toLocaleString('de-DE', { hour12: false }); | ||
const logPath = join(__dirname, 'httpdocs', 'log.txt'); | ||
fs.appendFileSync(logPath, `Express: Server: ${date} \n`); | ||
console.log(`Server läuft unter http://localhost:${port}`); | ||
}); |