I currently have:
const http = require('http');
const express = require('express');
const app = express();
app.get("/", (request, response) => {
console.log(Date.now() + " Ping Received");
response.sendStatus(200);
});
app.listen(process.env.PORT);
setInterval(() => {
http.get(`https://chef.glitch.me/`);
}, 280000);
In my Discord Bot Code, but I also want to have a attached website to it. But to keep the website up and working I need to have in my server.js:
// server.js
// where your node app starts
// init project
const express = require('express')
const app = express()
// we've started you off with Express,
// but feel free to use whatever libs or frameworks you'd like through `package.json`.
// http://expressjs.com/en/starter/static-files.html
app.use(express.static('public'))
// http://expressjs.com/en/starter/basic-routing.html
app.get("/", (request, response) => {
response.sendFile(__dirname + '/views/index.html')
})
// listen for requests :)
const listener = app.listen(process.env.PORT, () => {
console.log(`Your app is listening on port ${listener.address().port}`)
})
How can I have both in one project?