Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
How to craft Post requests for MEAN Stack?

I am currently programming a reminders app based on this project in an effort to learn JS and MEAN Stack. As part of my project, I am trying to add a date which each reminder is to be completed by. However, when using Postman to POST in a date, I am receiving an error message unless I cut the date field and only use JSON to put the reminder's title in. If I use Javascript for my POST, it greys out the title field in my POST's body and when I attempt to use JSON, the time field's entry is not recognized. The pertinent code is below. Any help is appreciated.

const express = require('express');
const app = express();

const mongoose = require('./db/mongoose');

const bodyParser = require('body-parser');
const {List, Reminder} = require('./db/models')
app.post('/lists/:listId/reminder', (req, res) => {//add a reminder to the specified list
    let newReminder = new Reminder({
        title: req.body.title,
        _listId: req.params.listId,
        time: req.body.time
    });
    newReminder.save().then((newReminderDoc) => {
        res.send(newReminderDoc);
    })
}) 
const mongoose = require('mongoose');

const ReminderSchema = new mongoose.Schema({
    title:{
        type: String,
        required: true,
        minlength: 1,
        trim: true
    },
    _listId:{
        type: mongoose.Types.ObjectId,
        required: true
    },
    time:{
        type: Date,
        required: true
    }
});

const Reminder = mongoose.model('Reminder', ReminderSchema);

module.exports = { Reminder }

JS Query I am trying to used:

{
title: "Test",
created: new Date("2016-12-12")
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!