Created
January 15, 2020 12:07
-
-
Save cemdrk/bf9742da99ecd8fa75fd2e078b54824f to your computer and use it in GitHub Desktop.
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
// index | |
const http = require('http'); | |
const handler = (req, res) => { | |
res.writeHead(200, {'Content-Type': 'application/json; charset=utf-8'}); | |
res.end(JSON.stringify({message: 'REST API Örneği'})); | |
}; | |
const server = http.createServer(handler); | |
const HOST = process.env.HOST || '127.0.0.1'; | |
const PORT = process.env.PORT || 8000; | |
process.on('uncaughtException', err=> console.log(err)); | |
server.listen(PORT, HOST, ()=>console.log('running on : %s:%d', HOST, PORT)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment