Gruber

Deno

This module provides the integration between Gruber and Deno, along with platform-specific utilities and Gruber primative.

Install

Gruber is available at esm.r0b.io/gruber@0.9.0-beta.2/mod.ts, add it to your deno.json:

{
  "imports": {
    "gruber/": "https://esm.r0b.io/gruber@0.9.0-beta.2/"
  }
}

Then use it these entrypoints:

  • gruber/mod.ts
  • gruber/config/mod.ts
  • gruber/core/mod.ts
  • gruber/http/mod.ts
  • gruber/postgres/mod.ts
  • gruber/testing/mod.ts

For example:

import { defineRoute } from "gruber/mod.ts";

Integrations

There are platform-specific integrations with the Configuration, Postgres & Terminator modules:

import { getConfiguration, getPostgresMigrator, getTerminator } from "gruber";

// Get a Deno specific Configuration instance that
// loads files uses 'Deno.readTextFile' and parses them through JSON
const config = getConfiguration();

// Get a Migrator using the Deno filesystem and
// the postgres.js library
const migrator = getPostgresMigrator({
  sql: postgres("postgres://…"),
  directory: new URL("./migrations/", import.meta.url),
});

// Get a terminator that listens to Deno's addSignalListener
const arnie = getTerminator();

Utilities

There aren't currently any Deno-specific utilities

TODO: the current TypeScript generated API Docs doesn't work with Deno yet.

Exported symbols:

  • getConfigurationOptions
  • getConfiguration
  • DenoRouter
  • serveRouter
  • getPostgresMigratorOptions
  • getPostgresMigrator
  • getTerminatorOptions
  • getTerminator
debug
{}