import databaseConfig from './config/database.config';
@Module({
imports: [
ConfigModule.forRoot({
load: [databaseConfig],
}),
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { ConfigModule } from '@nestjs/config'; | |
import { join } from 'path'; | |
require('dotenv').config(); | |
@Module({ | |
imports: [ | |
ConfigModule.forRoot({ | |
envFilePath: process.env.APP_ENV === 'dev' ? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { ConfigModule } from '@nestjs/config'; | |
import databaseConfig from './database.config'; | |
@Module({ | |
imports: [ConfigModule.forFeature(databaseConfig)], | |
providers: [], | |
exports: [] | |
}) | |
export class CouchdbModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Module } from '@nestjs/common'; | |
import { ConfigModule } from '@nestjs/config'; | |
import databaseConfig from './database.config'; | |
@Module({ | |
imports: [ConfigModule.forFeature(databaseConfig)], | |
providers: [], | |
exports: [] | |
}) | |
export class CouchdbModule { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import databaseConfig from './config/database.config'; | |
@Module({ | |
imports: [ | |
ConfigModule.forRoot({ | |
load: [databaseConfig], | |
}), | |
], | |
}) | |
export class AppModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable, Inject} from '@nestjs/common'; | |
import databaseConfig from '../database.config'; | |
import { ConfigType } from '@nestjs/config'; | |
@Injectable() | |
export class CouchdbService{ | |
constructor( | |
@Inject(databaseConfig.KEY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FactoryProvider, Logger } from "@nestjs/common"; | |
import {Configuration, DocumentScope} from 'nano' | |
import nano = require("nano"); | |
import { ConfigType } from "@nestjs/config"; | |
import databaseConfig from "../database.config"; | |
import { User } from "src/user/user"; | |
export const userDocScopeFactory: FactoryProvider = { | |
provide: 'UserDocumentScope', | |
useFactory: async (dbConfig: ConfigType<typeof databaseConfig>):Promise<DocumentScope<User>> => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Hi from main.js'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Hi from TypeScript'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
/* Visit https://aka.ms/tsconfig.json to read more about this file */ | |
/* Basic Options */ | |
// "incremental": true, /* Enable incremental compilation */ | |
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ | |
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ | |
// "lib": [], /* Specify library files to be included in the compilation. */ | |
"allowJs": true, /* Allow javascript files to be compiled. */ |
OlderNewer