express.js - body-parser - specific uri

 

Commit

code
var express = require('express');
var bodyParser = require('body-parser')
var app = express()
    .use( '/test', bodyParser() ).use(function (req, res) {
        console.log("body", req.body)
        console.log("foo", req.body.foo)
        res.send(req.body)
    })
    .listen(3000);

execute
$ node app.js

curl
$ curl -s  http://127.0.0.1:3000/test/  -H "content-type: application/json" -d   "{\"foo\":123}"
{"foo":123}

沒有留言:

張貼留言

Lessons Learned While Benchmarking vLLM with GPU

Recently, I benchmarked vLLM on a GPU to better understand how much throughput can realistically be expected in an LLM serving setup. One ...