As a newcomer to this field, I must apologize if my issue has an obvious solution. However, I am encountering the following error:
TypeError: res.status(...).sendFile is not a function
at app.get (/root/discordtest/server.js:10:19)
at callbacks (/root/node_modules/express/lib/router/index.js:164:37)
at param (/root/node_modules/express/lib/router/index.js:138:11)
at pass (/root/node_modules/express/lib/router/index.js:145:5)
at Router._dispatch (/root/node_modules/express/lib/router/index.js:173:5)
at Object.router [as handle] (/root/node_modules/express/lib/router/index.js:33:10)
at next (/root/node_modules/connect/lib/proto.js:174:15)
at next (/root/node_modules/connect/lib/proto.js:149:78)
at Object.expressInit [as handle] (/root/node_modules/express/lib/middleware.js:30:5)
at next (/root/node_modules/connect/lib/proto.js:174:15)
This is the code snippet I am using:
const express = require('express');
const path = require('path');
const app = express();
// Routes
app.use('/api/discord', require('./api/discord'));
app.get('/', (req, res) => {
res.status(200).sendFile(path.join(__dirname, 'index.html'));
});
app.listen(50451, () => {
console.info('Running on port 50451');
});