1
1
Fork 0
mirror of https://github.com/Akif9748/akf-forum.git synced 2025-07-16 03:40:59 +03:00
akf-forum/routes/post/createThread.js
2022-02-26 21:12:54 +03:00

12 lines
No EOL
361 B
JavaScript

const { User, Thread } = require("../../classes/index");
module.exports = (req, res) => {
if (!req.session.loggedin) return res.redirect('/login');
const info = req.body;
const thread = new Thread(info.title, info.content, new User().getId(req.session.userid)).takeId();
thread.write()
res.redirect('/threads/' + thread.id);
}