-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from moonstar-x/bugfix/level-repl
Bugfix/level repl
- Loading branch information
Showing
7 changed files
with
56 additions
and
19 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const http = require('http'); | ||
const logger = require('@greencoast/logger'); | ||
|
||
const keepAlive = ({ text, port }) => { | ||
const portToUse = port || 3000; | ||
|
||
const server = http.createServer((_, res) => { | ||
res.writeHead(200); | ||
res.end(text || "I'm alive."); | ||
}); | ||
server.listen(portToUse); | ||
|
||
logger.info(`Started an HTTP server on port ${portToUse}. You should use a service like UptimeRobot to poll the web address associated to this service to keep the bot alive.`); | ||
|
||
return server; | ||
}; | ||
|
||
module.exports = { | ||
keepAlive | ||
}; |