local-web-test



A local Node.js-based test server

Support for quickly starting web container services

Support fast send GET, POST requests, and record in /log folder, and output in console

Supports a function to complete cORS cross-domain requests

Install

npm install --save local-web-testCopy the code

Usage

Create a local static server

The first argument is the static file address and the second argument is the port number eg;

var test = require('local-web-test');
test.static('./', 3344);Copy the code

Create a GET request

/log/data.js The first argument is the URL and the second argument is the port number eg;

var test = require('local-web-test');
test.get('./', 3344);Copy the code

Creating a POST request

Print the POST request with the first parameter as the POST address and the second parameter as the port number. The read JSON data will be output to the console and written to a file in the path of./log/data. JSON eg

var test = require('local-web-test');
test.post('./', 3344);Copy the code

Cors

Create the GET Cors request

/log/data.js the first argument is the get address and the second argument is the port number, which will output the read JSON data to the console and write it to the file. The file path is log/data.json, and the third parameter is the cORS domain name. Cookice eg is supported by default:

var test = require('local-web-test');
test.getCors('./', 3344, '*');Copy the code

Creating a POST request

The first parameter is the POST address, the second parameter is the port number, and the read JSON data will be output to the console and written to a file path of./log/data. JSON, and the third parameter is the CORS domain name eg

var test = require('local-web-test');
test.post('./', 3344, '*');Copy the code

Update record

2018 08月17日 1.0.0, 2018 08月17日 1.0.1 added English documentation (added)

Rely on

The package relies on body-parser cookie-Parser Express Multer

thanks

No man or woman ╮ (╯ del ╰) ╭

Package address

www.npmjs.com/package/loc…

github

Github.com/mySoul8012/…