Last active
August 20, 2020 16:33
-
-
Save digitalbocca/ff4507e1633961786dd4926d652d4dbc to your computer and use it in GitHub Desktop.
Express multipart - json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id='form'enctype="application/json" action="http://localhost:3000", method="post"> | |
<input id ='Input1' type="text" placeholder="NOME" name='nome'> | |
<input id='Input2' type="text" placeholder="EMAIL" name='email'> | |
<button id='Button' type="submit">Enviar</button> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cors = require('cors') | |
const express = require('express') | |
const app = express() | |
app.use(cors()) | |
// app.use(express.json()) | |
app.use(express.urlencoded()) | |
app.post("/" , (req, res) => { | |
console.log(req.body) | |
res.status(201).json('Inserido') | |
}) | |
app.listen(3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment