hardhat-servers
v1.2.0
Published
A hardhat plugins that provides tasks to launch an IPFS and/or HTTP server(s) in an in-project local directory
Downloads
4
Readme
hardhat-servers
A hardhat plugin to mount static servers (HTTP and IPFS) from an in-project's local directory.
Installation
Install this package in your hardhat project (this was tested in a project depending on [email protected]) with the following command:
npm install --save-dev hardhat-common-tools@^1.3.0 hardhat-enquirer-plus@^1.4.0 hardhat-servers@^1.2.0
Then, in your hardhat.config.js
file, just require it:
require("hardhat-common-tools");
require("hardhat-enquirer-plus");
require("hardhat-servers");
Usage
You'll have two new commands at your disposal:
HTTP
To mount an HTTP server:
npx hardhat serve http
The contents will be served from the in-project's directory: .local/http
. For example,
by hitting http://localhost:8081/some-image.png
will serve the contents from the file
.local/http/some-image.png
.
This is meant to be only local, so ensure you .gitignore your .local
directory.
See npx hardhat serve http --help
for more details.
IPFS
To mount an IPFS stack:
npx hardhat serve ipfs
The contents will be served from the in-project's directory: .local/ipfs/content
. The
files are hashed and served directly from that directory (check the console as they are
scanned, for the CID values will be generated there).
Again: this is only meant to be local, so ensure you .gitignore your .local
directory.
See npx hardhat serve ipfs --help
for more details (specially the ports that can be
configured).
Closing the servers
Pressing any key closes each server.