Csrinru Forums Verified -

// models/Forum.js const mongoose = require('mongoose');

module.exports = router; <!-- Display Verification Badge --> <div *ngIf="forum.verified"> <i class="verified-badge">Verified</i> </div> csrinru forums verified

// Verify a forum router.patch('/:id/verify', async (req, res) => { try { const forum = await Forum.findByIdAndUpdate(req.params.id, { verified: true }, { new: true }); res.json(forum); } catch (err) { res.status(404).json({ message: 'Forum not found' }); } }); // models/Forum

module.exports = mongoose.model('Forum', forumSchema); // controllers/ForumController.js const express = require('express'); const router = express.Router(); const Forum = require('../models/Forum'); // models/Forum.js const mongoose = require('mongoose')

router.get('/:id', async (req, res) => { try { const forum = await Forum.findById(req.params.id); res.json(forum); } catch (err) { res.status(404).json({ message: 'Forum not found' }); } });

const forumSchema = new mongoose.Schema({ name: String, description: String, verified: { type: Boolean, default: false } });

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *


Notice: Trying to access array offset on value of type bool in /home/droidman/techpanorma.com/wp-content/themes/jannah/framework/functions/theme-functions.php on line 1428
Close