import { Mongoose } from '@appt/mongoose';

At the example below, we have a component that needs to act as a database connector of an application. By default, an Appt component is just a class with a "signature" that it can be injected by other class. As our component here needs to a specific behavior, we need to make use of a Special-Type Extender called TDatabase. This special type makes part of the @appt/core package and it indicates our component should act as a database connector, but it does not know how or which kind of database to connect. That's why we need to use a "driver", which here is "Mongoose". At this point, you only need to provide the uri connection and, if you need a little more configuration, pass into options attribute any param allowed by the mongoose connection.

import { Component, TDatabase } from '@appt/core';
import { Mongoose } from '@appt/mongoose';
const config = {
uri: 'mongodb://localhost:27017/appt-demo',
options: {
debug: true,
useNewUrlParser: true,
keepAlive: true
extend: TDatabase(Mongoose, config.uri, config.options)
export class AppDatabase{}