-
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.
- Loading branch information
Showing
2 changed files
with
28 additions
and
8 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 |
---|---|---|
@@ -1,9 +1,30 @@ | ||
import express from 'express' | ||
// import express from 'express' | ||
|
||
const PORT = 3000 | ||
const app = express() | ||
app.use(express.static('./dist')) | ||
// const PORT = 3000 | ||
// const app = express() | ||
// app.use(express.static('./dist')) | ||
|
||
app.listen(PORT, () => { | ||
console.log(`Server works on ${PORT}`) | ||
}) | ||
// app.listen(PORT, () => { | ||
// console.log(`Server works on ${PORT}`) | ||
// }) | ||
|
||
import express from 'express'; | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
|
||
const app = express(); | ||
const PORT = 3000; | ||
|
||
const filename = fileURLToPath(import.meta.url); | ||
|
||
const dirname = path.dirname(filename); | ||
|
||
app.use(express.static(path.join(dirname, 'dist'))); | ||
|
||
app.get('/*', (req, res) => { | ||
res.sendFile('index.html', { root: path.join(dirname, 'dist') }); | ||
}); | ||
|
||
app.listen(PORT, function () { | ||
console.log(`Сервер запущен на ${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