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 :: how to get contrast from a color using js 
Javascript :: js array sum 
Javascript :: remove time from date javascript 
Javascript :: node-json-db example 
Javascript :: refresh event in javascript 
Javascript :: How to access the request body when POSTing using Node.js and Express 
Javascript :: js get part of array 
Javascript :: express start template 
Javascript :: postgresql update json field key value 
Javascript :: how to tell c++ a function exists before calling 
Javascript :: string contains in javascript 
Javascript :: get the difference between two dates js 
Javascript :: jquery fade opacity 
Javascript :: getkey by value js 
Javascript :: firebase timestamp 
Javascript :: how to check if a message has an attachment discord js 
Javascript :: read from s3 bucket nodejs 
Javascript :: input radio checked jquery 
Javascript :: jquery this 
Javascript :: digit count in javascript 
Javascript :: isset js 
Javascript :: how to change background image for a webpage 
Javascript :: ciclo for javascript 
Javascript :: get date javascript format 
Javascript :: javascript insert last character of string 
Javascript :: dynamically adding marker react native mapbox 
Javascript :: js cookies 
Javascript :: exceljs read file 
Javascript :: We often use anonymous functions as arguments of other functions. For example: 
Javascript :: javascript deep clone 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =