@slicknode/slicknode-express
TypeScript icon, indicating that this package has built-in type declarations

0.1.4 • Public • Published

IMPORTANT: All functionality in this package should be considered an internal API that is subject to change without notice. Please check out the official Slicknode Documentation to learn how to use the public APIs.

Slicknode Express Handler

Express handler to serve the Slicknode GraphQL and admin API.

Usage

import express from 'express';
import { createHandler } from './create-handler';

const PORT = 3000;

const app = express();
app.use(
  '/',
  createHandler({
    // Path to your Slicknode project root dir
    dir: './',

    // Automatically apply migrations on start (Can quickly lead to accidental data deletion)
    forceMigrate: true,

    // Database configuration
    database: {
      // Database schema name to use for the project
      schemaName: 'test',

      connection: {
        // PostgreSQL connection URL
        url: 'postgresql://postgres:mysecretpassword@localhost:5432/master',
      },
    },
    // Enable Slicknode console integration
    admin: {
      // Admin secret that is also setup in the Slicknode console (min 20 characters)
      secret: '12345678901234567890',
    },
  })
);
app.listen(PORT, () => {
  console.log(`Server listening on: http://localhost:${PORT}`);
});

Readme

Keywords

none

Package Sidebar

Install

npm i @slicknode/slicknode-express

Weekly Downloads

5

Version

0.1.4

License

OSL-3.0

Unpacked Size

29.6 kB

Total Files

30

Last publish

Collaborators

  • ivome