建立第一支NodeJS程式

Hello World!

const http=require('http');
const port=process.env.PORT || 3000;
const server=http.createServer((req,res)=>{
   res.writeHead(200,{'Content-Type':'text/plain'});
   res.end('Hello World!');
});
server.listen(port,()=>console.log('Server Started On Port:',port));