tweaking and adding homepage with trending and so on

This commit is contained in:
2024-01-25 16:25:03 +01:00
parent 421ab338fc
commit 3ad55cd36a
8 changed files with 351 additions and 2 deletions
+9
View File
@@ -3,6 +3,7 @@ const dotenv = require('dotenv');
const cors = require('cors');
const {auth} = require('./auth/middleware');
const cookieParser = require('cookie-parser');
const {updateAll} = require('./jobs/jobs');
dotenv.config();
@@ -15,10 +16,18 @@ app.listen(process.env.PORT || 5000, () => {
console.log(`Server is running on port ${process.env.PORT || 5000}`);
});
//run a function every 12 hours
setInterval(() => {
console.log('Updating homepage');
updateAll();
}, 43200000);
app.use('/register', require('./routes/register.js'));
app.use('/login', require('./routes/login.js'));
app.use('/user', require('./routes/user.js'));
app.use('/create', auth, require('./routes/create.js'));
app.use('/post', require('./routes/posts.js'));
app.use('/search', require('./routes/search.js'));
app.use('/home', require('./routes/homepage.js'));
module.exports = app;