Skip to content

Instantly share code, notes, and snippets.

@cemdrk
Created January 15, 2020 12:07
Show Gist options
  • Save cemdrk/bf9742da99ecd8fa75fd2e078b54824f to your computer and use it in GitHub Desktop.
Save cemdrk/bf9742da99ecd8fa75fd2e078b54824f to your computer and use it in GitHub Desktop.
// 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