Answers for "how to make an express app"

49

express hello world

//to run : node filename.js
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}`))

//visit localhost:3000
// assuming you have done 1) npm init 2) npm install express
Posted by: Guest on July-17-2020
6

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!
Posted by: Guest on July-03-2020
1

generate express js project

npm i express -g

express --view=pug myapp
Posted by: Guest on October-08-2021
0

npx create-express-api

npm install -g create-express-api
Posted by: Guest on August-31-2020
2

initialize express app

npx express-generator
Posted by: Guest on August-15-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language