1// this is your code
2// ZDev1#4511 on discord if you want more help!
3// first you should install express in the terminal
4// `npm i express`.
5const express = require('express');
6const app = express();
7
8// route
9app.get('/', (req,res)=>{
10 // Sending This is the home page! in the page
11 res.send('This is the home page!');
12});
13
14// Listening to the port
15let PORT = 3000;
16app.listen(PORT)
17
18// FINISH!
1// create directory
2
3//npm init -y
4//npm i express --save
5
6//create public directory
7//create server.js
8
9// <---- In the server js file --->
10
11'use strict';
12
13const express = require('express');
14const app = express();
15app.use(express.static('public'));// to connect with frontend html
16app.use(express.json());//body parse
17
18app.get('/', function(req,res){
19 res.send('This is the Homepage');
20 //res.sendFile('index.html');
21});
22
23app.listen(3000);
24