Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to make an express server

// this is your code
// ZDev1#4511 on discord if you want more help!
// first you should install express in the terminal
// `npm i express`.
const express = require('express');
const app = express();

// route
app.get('/', (req,res)=>{
  // Sending This is the home page! in the page
  res.send('This is the home page!');
});

// Listening to the port
let PORT = 3000;
app.listen(PORT)

// FINISH!
Comment

javascript express 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}`)
})
Comment

express js server

const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;

app.get('/', (req, res) => {
  res.send('<h1>Some HTML</h1>');
  res.send('<p>Even more HTML</p>');
});

app.listen(PORT, () => console.log(`Server is listening on port ${PORT}`));
Comment

Express Server

const express = require("express")

const app = express()

app.listen(5000, () => {
	console.log("Server has started!")
})
Comment

require express server.js

const express = require('express')const app = express() app.get('/', function (req, res) {  res.send('Hello World')}) app.listen(3000)
Comment

PREVIOUS NEXT
Code Example
Javascript :: puppeteer stealth 
Javascript :: node redirection 
Javascript :: react js router parameters 
Javascript :: Password checking regex 
Javascript :: linking in react native 
Javascript :: javascript regex escape forward slash 
Javascript :: javascript open new window and pass data 
Javascript :: javascript remove first space in string 
Javascript :: react next alias import 
Javascript :: docker react module not found 
Javascript :: javascript copy an array 
Javascript :: how to check if connected to internet js 
Javascript :: nodejs execute every minute 
Javascript :: play music from file js 
Javascript :: angular adding delay 
Javascript :: image not showing js 
Javascript :: on uncheck checkbox hide button jquery 
Javascript :: javascript object first key 
Javascript :: js load multiple images 
Javascript :: angular one array contains any of second 
Javascript :: loop through object js 
Javascript :: useffect compare previous value to current 
Javascript :: link vs NavLink in React Router 
Javascript :: force page to reload on back button 
Javascript :: sum of number using reduce 
Javascript :: change image on hover js 
Javascript :: atob nodejs 
Javascript :: add css in javascript 
Javascript :: get current date 
Javascript :: check if number is single digit javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =