Jump to content
YOUR-AD-HERE
HOSTING
TOOLS

Locked JavaScript based Web Server


ssmss

Recommended Posts

NodeJS - Brings the JavaScript language to your OS, as a scripting language.

Link to nodejs:

This is the hidden content, please

 

Running a JavaScript file is similar to the way python does it.

In command shell: node file.js

Or in Linux: ./node file.js

 

Code:

// content of index.js const http = require('http') const port = 3000 const requestHandler = (request, response) => { console.log(request.url) response.end('Hello Node.js Server!') } const server = http.createServer(requestHandler) server.listen(port, (err) => { if (err) { return console.log('something bad happened', err) } console.log(`server is listening on ${port}`) })

Edited by ssmss
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.