Answers for "setting up server with express"

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
0

javascript express setting up a server

There are several steps for setting up a basic Express Server:

1. Run npm init -y
2. Install your dependencies (express)
3. Create a .gitignore file
4. Add node_modules to your .gitignore
5. Create the server directory
6. Create your index file
7. Require your dependencies
8. Declare your app variable
9. Declare your listen port
10. invoke the listen method and add a console log to the callback
11. run nodemon server/index.js in your terminal
12. success
Posted by: Guest on April-27-2021

Code answers related to "setting up server with express"

Code answers related to "Javascript"

Browse Popular Code Answers by Language