DEV Community

Discussion on: How to build a custom server with nodejs in 3 min

Collapse
 
aminnairi profile image
Amin

Hi Vikas and thanks for this article!

For people that are on the clock, you can even create a server in one terse line.

require("http").createServer((_, r) => r.end("Node.js")).listen(8080);
Enter fullscreen mode Exit fullscreen mode

You can even fire a Node.js server in a terminal.

$ node -e "require('http').createServer((_, r) => r.end('Node.js')).listen(8080)"
Enter fullscreen mode Exit fullscreen mode

This is not very interesting for most applications, but this is a cool trick to know!

Collapse
 
vkassingh profile image
Vikas Singh

thanks for sharing.