Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

body-data

Package Overview
Dependencies
Maintainers
0
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

body-data

一个轻量、小巧的Node.js模块,用于检索 GET 或 POST 请求数据 | A lightweight, small Node.js module for retrieving GET or POST request data

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-86.11%
Maintainers
0
Weekly downloads
 
Created
Source
语言: 中文 English

Body-Data

一个轻量、小巧的Node.js模块,用于检索 GET 或 POST 请求数据

Version dev MIT License

安装

npm install body-data --save

快速开始

// client
const script = document.createElement('script')
script.src = 'https://cdn.jsdelivr.net/npm/axios/dist/axios.js'
document.head.append(script)

const url = 'http://127.0.0.1:6870'
axios.get(url, { params: { name: 'Lete', age: 18 } })
axios.post(url, { name: 'Lete', age: 18 })

// server
const bodyData = require('body-data')
const http = require('http')

const server = http.createServer(async (req, res) => {
  res.setHeader('Content-Type', 'application/json; charset:utf-8;')
  const data = await bodyData(req)
  res.end(JSON.stringify(data)) // output: { name: 'Lete', age: 18 }
})

server.listen(6870)

Keywords

FAQs

Package last updated on 15 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc