JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q35991F
  • License MIT

Notion module for nest.js

Package Exports

  • nest-notion

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nest-notion) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nest-notion

npm npm

Nest module for using the Notion API.

Install

NPM

npm i nest-notion

Yarn

yarn add nest-notion

Usage

In app.module.ts:

import { Module } from '@nestjs/common';
import { NotionModule } from 'nest-notion';
import { ConfigModule } from '@nestjs/config';
import { VegetableModule } from './vegetable/vegetable.module';

@Module({
  imports: [
    ConfigModule.forRoot({ // Need this to use process.env.NOTION_SECRET if it is in .env
      isGlobal: true,
    }),
    NotionModule.forRoot({
      auth: process.env.NOTION_SECRET,
    }),
    VegetableModule,
  ],
})
export class AppModule {}

An example module you wish to use it in:

import { Module } from '@nestjs/common';
import { VegetableService } from './vegetable.service';

@Module({
  providers: [VegetableService],
  exports: [
    VegetableService,
  ],
})
export class VegetableModule {}

In the service within the module:

import { Injectable } from '@nestjs/common';
import { NotionService } from 'nest-notion';

@Injectable()
export class VegetableService {
  constructor(
    private readonly notionService: NotionService
  ) { }

  listUsers() {
    return this.notionService.notion.users.list({ page_size: 10 });
  }
}