Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express sendfile root path

const express = require('express');

const app = express();

app.get('/', (req, res) => {
//send file root path index.html
  res.sendFile('index.html', { root: __dirname });
});

app.listen(3000, () => {
  console.log('Running ws://localhost:3000');
});
 
PREVIOUS NEXT
Tagged: #express #sendfile #root #path
ADD COMMENT
Topic
Name
8+5 =