architect-knex

Expose KnexJS query builder to architect framework

Usage no npm install needed!

<script type="module">
  import architectKnex from 'https://cdn.skypack.dev/architect-knex';
</script>

README

architect-knex

Expose knex query builder knex as architect plugin.

Installation

npm install --save architect-knex

Usage

Boot Architect :

var path = require('path');
var architect = require("architect");

var config = architect.loadConfig(path.join(__dirname, "config.js"));

architect.createApp(config, function (err, app) {
    if (err) {
        throw err;
    }
    console.log("app ready");
});

Configure Architect with config.js to access a SQLite3 in memory database *:

module.exports = [{
    packagePath: "architect-knex",
    settings: {
        default: {
            dialect: 'sqlite3',
            connection: {
                database: ':memory:'
            }
        }
    }
}, './repos'];
  • Don't miss to add sqlite3 in your project dependency

Consume knex plugin in your ./repos/package.json :

{
  "name": "repos",
  "main": "index.js",
  "private": true,

  "plugin": {
    "consumes": ["knex"]
  }
}