Skip to content
Snippets Groups Projects
Commit 0700c73a authored by Alan Chamathil's avatar Alan Chamathil
Browse files

v2 with retriving notifications

parent 952618a4
No related branches found
No related tags found
No related merge requests found
...@@ -16,14 +16,18 @@ const Notification = require('../schema/schema') ...@@ -16,14 +16,18 @@ const Notification = require('../schema/schema')
router.get("/info/:id",(req,res) =>{ router.get("/info/:id",(req,res) =>{
res.send("id")
// grab the userid // grab the userid
const user_id =req.params.id;
// retrieve all the notifcations stored in the database // retrieve all the notifcations stored in the database
Notification.findById(req.params.id).then((notifiaction) => {
if(!notifiaction){
return res.status(404).send();
}
res.send(notifiaction);
}).catch((error) => {
res.status(500).send(error);
})
// send the notifications to the notification page // send the notifications to the notification page
......
const mongoose = require('mongoose'); const mongoose = require('mongoose');
const notificationSchema = new mongoose.Schema({ const notificationSchema = new mongoose.Schema({
userid:Number,
title: String, title: String,
description: String, description: String,
date: Date date: Date
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment