-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
N8
committed
Dec 31, 2023
1 parent
1adbcc8
commit 755dd98
Showing
7 changed files
with
134 additions
and
223 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import express from 'express'; | ||
import cors from 'cors'; | ||
import { fileURLToPath } from 'url'; | ||
import { dirname, join } from 'path'; | ||
|
||
const app = express(); | ||
|
||
// Enable CORS for all routes | ||
app.use(cors()); | ||
|
||
// Since __dirname is not defined in ES modules, you have to derive it | ||
const __filename = fileURLToPath( | ||
import.meta.url); | ||
const __dirname = dirname(__filename); | ||
|
||
// Serve static files from the 'public' directory (update the path as necessary) | ||
app.use(express.static(__dirname)); | ||
|
||
const port = process.env.PORT || 8080; | ||
|
||
app.listen(port, () => { | ||
console.log(`Server running on port ${port}`); | ||
}); |
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
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
Oops, something went wrong.