Skip to content

Instantly share code, notes, and snippets.

@armando-couto
Created March 21, 2021 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save armando-couto/5efaad21fc18ccc33e7f48613d29c0f6 to your computer and use it in GitHub Desktop.
Save armando-couto/5efaad21fc18ccc33e7f48613d29c0f6 to your computer and use it in GitHub Desktop.
Passo a Passo criando um projeto em Node.JS
$ 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