Send html page as a response from an API

PHOTO EMBED

Sat May 21 2022 17:18:43 GMT+0000 (UTC)

Saved by @venkatraorayala #restapi #no #express

import express from "express";
import path from 'path';

const app = express();
const PORT = process.env.PORT || 5000;

app.get('/',(req,res)=>{
    res.sendFile(path.resolve('index.html'));  
})

app.listen(PORT,()=> console.log('server is running'));
content_copyCOPY