Created
March 21, 2021 23:41
-
-
Save armando-couto/5efaad21fc18ccc33e7f48613d29c0f6 to your computer and use it in GitHub Desktop.
Passo a Passo criando um projeto em Node.JS
This file contains hidden or 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
$ mkdir ~/nodejs-mongodb | |
$ cd ~/nodejs-mongodb | |
$ nano package.json | |
Dentro do arquivo coloque, salve e feche. | |
{ | |
} | |
$ nano app.js | |
Dentro do arquivo coloque, salve e feche. | |
const http = require('http'); | |
const hostname = '127.0.0.1'; | |
const port = 3000; | |
const server = http.createServer((req, res) => { | |
res.statusCode = 200; | |
res.setHeader('Content-Type', 'text/plain'); | |
res.end('Hello World'); | |
}); | |
server.listen(port, hostname, () => { | |
console.log(`Server running at http://${hostname}:${port}/`); | |
}); | |
$ node app.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment