This commit is contained in:
David
2019-06-14 12:26:08 -07:00
commit 7f2f4661c7
5 changed files with 2047 additions and 0 deletions

18
server.js Normal file
View File

@@ -0,0 +1,18 @@
const http = require('http')
const PORT = process.env.PORT || 3000
const server = http.createServer((req, res) => {
if (req.url === '/') return respondHello(req, res)
res.end()
})
function respondHello (req, res) {
res.end(JSON.stringify({ msg: 'hello' }))
}
server.listen(PORT)
console.log(`Server listening on port ${PORT}`)
if (require.main !== module) module.exports = server