js unit8 ajax,GitHub - najaxjs/najax: jQuery ajax-stye http requests in node

najax是一个轻量级的Node.js模块,它为http.request对象提供了一个包装器,使得在服务器端进行Ajax请求时可以使用类似于jQuery的语法。支持GET、POST等多种HTTP方法,并能根据输入自动处理一些细节,所有选项都可通过传递一个options对象来覆盖。要开始使用,只需通过npm安装并调用示例代码即可。此外,项目还包含单元测试确保代码质量。
摘要由CSDN通过智能技术生成

najax

68747470733a2f2f7472617669732d63692e6f72672f6e616a61786a732f6e616a61782e7376673f6272616e63683d6d6173746572

68747470733a2f2f64617669642d646d2e6f72672f6e616a61786a732f6e616a61782e737667

68747470733a2f2f64617669642d646d2e6f72672f6e616a61786a732f6e616a61782f6465762d7374617475732e737667

68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d7374616e646172642d627269676874677265656e2e737667

jQuery ajax-stye http requests in node

jQuery ajax is stupid simple. This project provides a lightweight wrapper for the nodejs http request object that enables jquery ajax style syntax when making serverside requests to other webpages in node.js

In addition to najax.get, , handles ssl and makes some reasonable assumptions based on inputs and everything can be overridden by passing an options object.

Getting Started

Install the module with: npm install najax

var najax = $ = require('najax')

$.get('http://www.google.com', callback)

najax('http://www.google.com', { type: 'POST' }, callback)

najax({ url: 'http://www.google.com', type: 'POST', success: callback })

najax({ url: 'http://www.google.com', type: 'POST' })

.success(callback)

.error(errorHandler)

$.get, $.post, $.put, $.delete...

Run unit tests

npm install && npm test

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using standardjs.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值