This project provides an ExpressJS server to host your website from an Ordinal.
- NodeJS (v18+)
- NPM (comes with NodeJS)
- tsc (npm install -g typescript)
npm install
npm run start
Navigate to http://localhost:8080/ to view the demo page, or http://localhost:8080/971388081f6601b0e502adbfceef68d152e7f27ba5aff0230d2567aaa8acb768_0 to render an inscription.
import { RegisterRoutes } from 'ordfs-server';
const app = express();
...
RegisterRoutes(app);
2 DNS records are required
AorCNAMErecord to point domain to wherever this server is runningTXTrecord for the same domain, which points sever to InscriptionId which should function as home page for the domainordfs=<InscriptionID>- hostname should be prefixed with
_ordfs.ex_ordfs.subdomain.example.com
To get block height and hash, make a GET request to /v1/{network}/block/latest
<script type="application/javascript">
document.addEventListener("DOMContentLoaded", async () => {
const response = await fetch("/v1/bsv/block/latest");
const { height, hash } = await response.json();
console.log("Welcome to ORD-FS", { height, hash });
});
</script>ORDFS-NAME= Name of your OrdFS instance. This will be displayed on the demo page.
Set the following ENVIRONMENT VARS to point to your BTC Node. REST server must be enabled.
BTC_HOST=
BTC_PORT=
BTC_UN=
BTC_PW=
Set the following ENVIRONMENT VARS to point to your BSV Node. REST server must be enabled.
BITCOIN_HOST=
BITCOIN_PORT=
BITCOIN_UN=
BITCOIN_PW=