A simple HTTP/FTP local test server that can be run on Node.js.
The HTTP services (GET, POST with text/JSON/XML, POST with file) return whatever you send them. The FTP service allows you to access any files under the ./files
directory. Both would also print the content of payload in the console.
Install Node.js and download/unzip this project, then install the dependencies:
npm install
Run the http server (using default host/port or specify them):
node http.js
node http.js 127.0.0.1 8080
Run the FTP server (using default host/port or specify them):
node ftp.js
node ftp.js 127.0.0.1 21
Or start both with default host/ports:
npm start
http://localhost:8080/get
http://localhost:8080/get?params1=value1¶ms2=value2
The service would return the QueryString object in application/json
.
http://localhost:8080/post
You can use HTTP clients like Postman or Insomnia. The service would return the payload in the same content type (text/plain
, application/json
or application/xml
).
The requester has to use POST and set the Content-Type
header to multipart/form-data
. The payload can be either a file or a text with any field name. Be noted that only the first text or file field will be read.
http://localhost:8080/post-file
The service would return the content of the text or file in text/plain.
The server also serves static files under /files
directory:
http://localhost:8080/files/<filename>
The default user is user
and password is pw
. You can read or write a file with a URL like this:
ftp://user:pw@localhost:21/test.txt
You can test this with curl
(Windows users can install Git and use Git Bash console for this):
curl ftp://user:pw@localhost:21/test.txt -v
You can put whatever files under ./files
and they will show up in the FTP server.