hyperdrive-inception

server-render a hyperdrive over http

Usage no npm install needed!

<script type="module">
  import hyperdriveInception from 'https://cdn.skypack.dev/hyperdrive-inception';
</script>

README

hyperdrive-inception

server render html and other static files that are fetched from inside of a hyperdrive over p2p connection(s).

you might want to do this so you can serve static website(s) via dat and score some SEO points while you're at it. about this module so far:

  • just a proof of concept. wip.
  • there is no api nor are there exports to include in other projects (yet). see todo's below.
  • this doesn't scale (yet).
  • p2p connection is just reading, not seeding.

Try it out

install dat on your command line if you haven't already:

npm install dat -g

from the command line install and run the server included in this repo from project root directory:

npm install
npm start

open up another command line terminal. from the root directory of this git repo, run:

dat share sample-dat

copy the hexadecimal share key that dat says it is now sharing with peers and paste it into your browser's address bar after the local server's address and port (http://127.0.0.1:5150) so it looks something like this:

http://127.0.0.1:5150/914bb67d73e68756f7613475aff37146c68df4f326da10dae2536670fc571e80

your local server is now serving up the sample-dat folder's index.html page that it fetched via p2p.

To Do

  • export routes containing hyperdrive logic so they can be included in other projects
  • read /#<archive key> addresses and redirect to /<archive key>
  • view individual static files at /<archive key>/<file name>
  • view revisions at /<archive key>/version/-1