hosting simple express app with hello world on apache server

122 views Asked by At
var express = require('express')

let app = express();

app.get('/',(req,res)=>{
res.send('Hello world')
})

app.listen(3000, () => console.log('Server running on http://localhost:3000/'));

above is the simple app i want it to host on apache. everytime server start,i should be able to ping this url in browser.

i am trying below in vhost file :-

Listen 3000
<VirtualHost *:3000>
DocumentRoot  D:/myapp
 <Directory  D:/myapp>

myapp is the folder where app.js and package-json is placed.

for react app i put the build path for DocumentRoot and Directory and it works,but for express app i am not able to do.

Please help me out with vhost configuration OR any other things if need .

0

There are 0 answers