Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

The connection between SQL and Postman doesn't let me post a date

$
0
0

This is the request of my server:

public async create(req: Request, res: Response): Promise<void> {        await pool.query(`exec CrearUser @password = '${req.body.password }', @creationdate = '${req.body.creationdate}', @activestate  = '${req.body.activestate }', @modificationdate  = '${req.body.modificationdate }'`);        console.log(req);        res.json({ 'Text': 'User creado' });    }

And this is the post of postman:

{"Password": "password5","CreationDate": "01-01-2024","ActiveState": true,"ModificationDate": null}

But when I send the post, the console tell:

SyntaxError: Unexpected token '', ..."tionDate": null}" is not valid JSONat JSON.parse ()at parse (E:\Final Semestre\Server\node_modules\body-parser\lib\types\json.js:89:19)at E:\Final Semestre\Server\node_modules\body-parser\lib\read.js:128:18at AsyncResource.runInAsyncScope (node:async_hooks:206:9)at invokeCallback (E:\Final Semestre\Server\node_modules\raw-body\index.js:231:16)at done (E:\Final Semestre\Server\node_modules\raw-body\index.js:220:7)at IncomingMessage.onEnd (E:\Final Semestre\Server\node_modules\raw-body\index.js:280:7)at IncomingMessage.emit (node:events:518:28)at endReadableNT (node:internal/streams/readable:1696:12)at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

I know that the problem is from the SQL Server but I don't know how to fix it.


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>