Skip to content

Repository files navigation

w3c-xmlhttprequest Node.js CI

Server-side XMLHttpRequest like Living Standard for Node.

Install

$ npm install w3c-xmlhttprequest

or

$ yarn add w3c-xmlhttprequest

Example

Simple GET request

import{XMLHttpRequest}from'w3c-xmlhttprequest';constclient=newXMLHttpRequest();client.open('GET','https://example.com/');client.addEventListener('load',()=>{console.log('Received an HTTP response.');}client.send();

Parse JSON response

import{XMLHttpRequest}from'w3c-xmlhttprequest';constclient=newXMLHttpRequest();client.open('GET','https://exmaple.com/data.json');client.responseType='json';client.addEventListener('load',()=>{constdata=client.response;if(data.meta.status!==200)return;console.log(data.response.blog.title);});client.send();

LICENSE

MIT License

About

server-side XMLHttpRequest for Node.

Resources

Code of conduct

Security policy

Stars

43 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages