mirror of
https://github.com/Eugeny/tabby-web.git
synced 2025-09-06 00:21:53 +00:00
.
This commit is contained in:
@@ -63,6 +63,7 @@
|
|||||||
"source-code-pro": "^2.30.1",
|
"source-code-pro": "^2.30.1",
|
||||||
"source-sans-pro": "^2.45.0",
|
"source-sans-pro": "^2.45.0",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
|
"throng": "^5.0.0",
|
||||||
"typescript": "~4.1",
|
"typescript": "~4.1",
|
||||||
"val-loader": "^4.0.0",
|
"val-loader": "^4.0.0",
|
||||||
"webpack": "^5.38.1",
|
"webpack": "^5.38.1",
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { install } from 'source-map-support'
|
import { install } from 'source-map-support'
|
||||||
|
import * as throng from 'throng'
|
||||||
|
|
||||||
import 'zone.js/dist/zone-node'
|
import 'zone.js/dist/zone-node'
|
||||||
import './ssr-polyfills'
|
import './ssr-polyfills'
|
||||||
@@ -9,31 +10,43 @@ import { ngExpressEngine } from '@nguniversal/express-engine'
|
|||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
|
|
||||||
install()
|
install()
|
||||||
enableProdMode()
|
enableProdMode()
|
||||||
|
|
||||||
const app = express()
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 4000
|
|
||||||
const DIST_FOLDER = join(process.cwd(), 'build')
|
|
||||||
|
|
||||||
import { AppServerModule } from './app.server.module'
|
import { AppServerModule } from './app.server.module'
|
||||||
|
|
||||||
app.engine('html', ngExpressEngine({
|
const engine = ngExpressEngine({
|
||||||
bootstrap: AppServerModule,
|
bootstrap: AppServerModule,
|
||||||
}))
|
|
||||||
|
|
||||||
app.set('view engine', 'html')
|
|
||||||
app.set('views', DIST_FOLDER)
|
|
||||||
|
|
||||||
app.get('*.*', express.static(DIST_FOLDER, {
|
|
||||||
maxAge: '1y',
|
|
||||||
}))
|
|
||||||
|
|
||||||
app.get('*', (req, res) => {
|
|
||||||
res.render('index', { req })
|
|
||||||
})
|
})
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
function start () {
|
||||||
console.log(`Node Express server listening on http://localhost:${PORT}`)
|
const app = express()
|
||||||
|
|
||||||
|
const PORT = process.env.PORT || 4000
|
||||||
|
const DIST_FOLDER = join(process.cwd(), 'build')
|
||||||
|
|
||||||
|
app.engine('html', engine)
|
||||||
|
|
||||||
|
app.set('view engine', 'html')
|
||||||
|
app.set('views', DIST_FOLDER)
|
||||||
|
|
||||||
|
app.get('*.*', express.static(DIST_FOLDER, {
|
||||||
|
maxAge: '1y',
|
||||||
|
}))
|
||||||
|
|
||||||
|
app.get('*', (req, res) => {
|
||||||
|
res.render('index', { req })
|
||||||
|
})
|
||||||
|
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Node Express server listening on http://localhost:${PORT}`)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const WORKERS = process.env.WEB_CONCURRENCY || 4
|
||||||
|
throng({
|
||||||
|
workers: WORKERS,
|
||||||
|
lifetime: Infinity,
|
||||||
|
start,
|
||||||
})
|
})
|
||||||
|
@@ -13,6 +13,9 @@ module.exports = {
|
|||||||
// 'index.server': path.resolve(__dirname, 'src/index.server.ts'),
|
// 'index.server': path.resolve(__dirname, 'src/index.server.ts'),
|
||||||
'server': path.resolve(__dirname, 'src/server.ts'),
|
'server': path.resolve(__dirname, 'src/server.ts'),
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false,
|
||||||
|
},
|
||||||
resolve: {
|
resolve: {
|
||||||
...baseConfig.resolve,
|
...baseConfig.resolve,
|
||||||
mainFields: ['esm2015', 'module', 'main'],
|
mainFields: ['esm2015', 'module', 'main'],
|
||||||
|
@@ -5362,6 +5362,13 @@ text-table@^0.2.0:
|
|||||||
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
|
||||||
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
|
integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=
|
||||||
|
|
||||||
|
throng@^5.0.0:
|
||||||
|
version "5.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/throng/-/throng-5.0.0.tgz#f9550c0221e579073f68a00be33a593d094e4d29"
|
||||||
|
integrity sha512-nrq7+qQhn/DL8yW/wiwImTepfi6ynOCAe7moSwgoYN1F32yQMdBkuFII40oAkb3cDfaL6q5BIoFTDCHdMWQ8Pw==
|
||||||
|
dependencies:
|
||||||
|
lodash "^4.17.20"
|
||||||
|
|
||||||
to-fast-properties@^1.0.3:
|
to-fast-properties@^1.0.3:
|
||||||
version "1.0.3"
|
version "1.0.3"
|
||||||
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
|
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"
|
||||||
|
Reference in New Issue
Block a user