FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
github-docs/server.js at main · 0xdevalias/github-docs · GitHub
0xdevalias
/
github-docs
Public
forked from
github/docs
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
github-docs
/
server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
40 lines (35 loc) · 1.43 KB
Breadcrumbs
github-docs
/
server.js
Copy path
File metadata and controls
40 lines (35 loc) · 1.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require
(
'./lib/check-node-version'
)
require
(
'./lib/handle-exceptions'
)
require
(
'./lib/feature-flags'
)
const
express
=
require
(
'express'
)
const
portUsed
=
require
(
'port-used'
)
const
warmServer
=
require
(
'./lib/warm-server'
)
const
port
=
Number
(
process
.
env
.
PORT
)
||
4000
const
app
=
express
(
)
require
(
'./middleware'
)
(
app
)
// prevent the app from starting up during tests
/* istanbul ignore next */
if
(
!
module
.
parent
)
{
// check that the development server is not already running
portUsed
.
check
(
port
)
.
then
(
async
status
=>
{
if
(
status
===
false
)
{
// If in a deployed environment, warm the server at the start
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
// If in a true production environment, wait for the cache to be fully warmed.
if
(
process
.
env
.
HEROKU_PRODUCTION_APP
||
process
.
env
.
GITHUB_ACTIONS
)
{
await
warmServer
(
)
}
}
// workaround for https://github.com/expressjs/express/issues/1101
const
server
=
require
(
'http'
)
.
createServer
(
app
)
server
.
listen
(
port
,
(
)
=>
console
.
log
(
`app running on http://localhost:
${
port
}
`
)
)
.
on
(
'error'
,
(
)
=>
server
.
close
(
)
)
}
else
{
console
.
log
(
`\n\n\nPort
${
port
}
is not available. You may already have a server running.`
)
console
.
log
(
'Try running `killall node` to shut down all your running node processes.\n\n\n'
)
console
.
log
(
'\x07'
)
// system 'beep' sound
process
.
exit
(
1
)
}
}
)
}
module
.
exports
=
app
Back
|
FazBrowse Home
|
New Git URL