“Node.js Web Server” Respostas de código

Como criar um servidor no nó js

// code by VARSHITH REDDY SATTI
// to create a server in node.js you should.
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/html'});
  res.write("write html code to display you test")
  res.end();
}).listen(8080);
// save this as httpServer.js
// run this by typing node httpServer.js in the command line
// to acess your server got to http://localhost:8080
Crown Of Thorns Starfish

Nó JS Server

const express = require('express')
const app = express()
const port = 3000

app.get('/', (req, res) => res.send('Hello World!'))

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`))
Encouraging Elk

Node.js Web Server

var http = require('http');

http.createServer(function (req, res) {
	res.write('Hello World!');
    res.end();
}).listen(8080);
Astra Logical

Respostas semelhantes a “Node.js Web Server”

Procure respostas de código populares por idioma

Procurar outros idiomas de código