“Terima data JSON di Express” Kode Jawaban

Express Req Get Json

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

app.use(express.json());

app.post('*', (req, res) => {
  req.body;	// The json object sent to the server
});
const port = 3000;
app.listen(port, () => console.log(`Listening on port ${port}.`));
garzj

Terima data JSON di Express


var express = require('express');

var app = express();

app.use(express.json());

app.post('/', function(request, response){
  console.log(request.body);      // your JSON
   response.send(request.body);    // echo the result back
});

app.listen(3000);

Fair Ferret

Terima data JSON di Express

//backend/server.js
//middleware to accept json in request body
app.use(express.json())
Sab Tech

Jawaban yang mirip dengan “Terima data JSON di Express”

Pertanyaan yang mirip dengan “Terima data JSON di Express”

Lebih banyak jawaban terkait untuk “Terima data JSON di Express” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya