koa-orbit
v0.2.1
Published
A server interface for Orbit sources
Downloads
9
Readme
Koa Orbit
A server interface for Orbit sources
Getting started
A getting started template is available at orbit-server-template
Installation
Install with yarn:
yarn add koa-orbit
import koaOrbit from 'koa-orbit';
import SQLSource from 'orbit-sql';
import { RecordSchema } from '@orbit/records';
const app = new Koa();
const source = new SQLSource({
schema: new RecordSchema({
models: {
todo: {
attributes: {
title: { type: 'string' },
checked: { type: 'boolean' }
}
}
}
}),
knex: {
client: 'sqlite3',
connection: { filename: ':memory:' },
useNullAsDefault: true,
},
});
const router = koaOrbit({ source });
app.use(router.routes());
app.use(router.allowedMethods());
app.listen(3000);