Using Postman to test Post route

I’m working on the Boss-Machine project and am trying to use POSTMAN validate a route I’m creating. When I send the request through Postman I get Error: Minion's salary must be a number..

I’m using the form-data radial tab under Body. Not sure how I get this to work.

Data format s/b:
//   
//   - id: string
//   - name: string
//   - title: string
//   - salary: number

Route below:


minionsRouter.post('/', (req, res, next) => {
    const insertNewMinion = addToDatabase('minions', req.body);
    res.send(201).send(insertNewMinion);
})
1 Like

I have the same problem. If anyone has a solution to this, let me know. I’d really appreciate it. Thanks.

It’s been a while since I did this project, but are you doing any error handling code? Like check if it is a number, or convert it to a number if it is a digit but in a string type?

Another thought… try selecting the raw tab under body and write the JSON in manually. Intentionally put your salary number without quotation marks.