“Buat server web di JavaScript” Kode Jawaban

cara membuat server di node 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

Buat server web di JavaScript

// Install Express First ( npm install express )
// Code By Asim
const express = require("express")
const app = express()
app.get("/", (req, res) => { // Replace "/" with The Link You Want
	res.send("Hello World !")
})
app.listen(3000, console.log("Listening In Port 3000") // 3000 Is The Port ( Change It If You Want )
// Want To Add Html ?
// Replace Line 6 with: res.send(`Type Your Html Here `)
// Or Just Use View Engine Like ejs .
// Save This File WIth Any name: index.js
// and run it with command: node (YourFileName) like this: node index.js
// Go To Your Server By Typing In Browser: localhost:(Your Port) like this: localhost:3000
Evil Elephant

Jawaban yang mirip dengan “Buat server web di JavaScript”

Pertanyaan yang mirip dengan “Buat server web di JavaScript”

Lebih banyak jawaban terkait untuk “Buat server web di JavaScript” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya