Skip to main content
Module

x/diplodocus/docs/index.md

πŸ¦• Deno Deploy Docs πŸ““
Go to Latest
File

toc: false

Diplodocus

Diplodocus is Static Assets Serving System only for Deno Deploy.

β€œDiplodocus” sounds like β€œDeploy docs” a little…?

  • Serve the assets on the GitHub repository
  • Parse the Markdown files to HTML pages

Quick start

Create docs directly and some markdown pages.

β”œβ”€β”€ docs/
β”‚  β”œβ”€β”€ about.md
β”‚  β”œβ”€β”€ index.md
β”‚  └── pages/
β”‚     β”œβ”€β”€ 01.md
β”‚     β”œβ”€β”€ 02.md
β”‚     └── 03.md
└── server.ts

Add links in index.md.

# index
- [about](/about)
- [page 01](/page/01)
- [page 02](/page/02)
- [page 03](/page/03)

Create server.ts. This is almost same as a sample script of Deno Deploy Beta 2.

// server.ts
import { Diplodocus } from "https://deno.land/x/diplodocus/mod.ts";

const diplodocus = await Diplodocus.load();

const port = 8080;
const listener = Deno.listen({ port });
console.log(`HTTP server listening on http://localhost:${port}`);

async function handleConn(conn: Deno.Conn) {
  const httpConn = Deno.serveHttp(conn);
  for await (const e of httpConn) {
    e.respondWith(diplodocus.handler(e.request));
  }
}

for await (const conn of listener) {
  handleConn(conn);
}

Run server.ts by deno run or deployctl and access to the local server.

$ deno run --allow-net --allow-read --no-check ./server.ts
$ # deplyctl run --no-check ./server.ts