This file contains hidden or 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 { Component, OnInit } from '@angular/core'; | |
| import { ConfigService } from '../shared/config.service'; | |
| @Component({ | |
| selector: 'app-department', | |
| templateUrl: './department.component.html', | |
| styleUrls: ['./department.component.css'] | |
| }) | |
| export class DepartmentComponent implements OnInit { |
This file contains hidden or 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 { Component, OnInit } from '@angular/core'; | |
| import { ConfigService } from '../shared/config.service'; | |
| @Component({ | |
| selector: 'app-employee', | |
| templateUrl: './employee.component.html', | |
| styleUrls: ['./employee.component.css'] | |
| }) | |
| export class EmployeeComponent implements OnInit { |
This file contains hidden or 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 '@angular/core'; | |
| import { configToken } from './demo.token'; | |
| import { Config } from './demo.config'; | |
| @Injectable({ | |
| providedIn: 'root' | |
| }) | |
| export class ConfigService { | |
| constructor(@Inject(configToken) private config: Config) { |
This file contains hidden or 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 { InjectionToken } from '@angular/core'; | |
| import { Config } from './demo.config'; | |
| export const configToken = new InjectionToken<Config>('demo token'); |
This file contains hidden or 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
| export interface Config { | |
| apiEndPoint: string; | |
| timeout: number; | |
| } |
This file contains hidden or 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 { Controller, Get, Param } from '@nestjs/common'; | |
| import { InMemoryDBService } from '@nestjs-addons/in-memory-db'; | |
| import { EmployeeEntity } from './entities/employee'; | |
| @Controller('employee') | |
| export class EmployeeController { | |
| constructor(private employeeService: InMemoryDBService<EmployeeEntity>) { | |
| } |
This file contains hidden or 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 { InMemoryDBModule } from '@nestjs-addons/in-memory-db'; | |
| import { EmployeeController } from './employee.controller'; | |
| @Module({ | |
| imports: [InMemoryDBModule.forFeature('employee')], | |
| controllers: [EmployeeController] | |
| }) | |
| export class EmployeeModule { |
This file contains hidden or 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 { InMemoryDBEntity } from '@nestjs-addons/in-memory-db'; | |
| export interface EmployeeEntity extends InMemoryDBEntity { | |
| name: string; | |
| email: string; | |
| department: string; | |
| age: number; | |
| } |
This file contains hidden or 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 { InMemoryDBModule } from '@nestjs-addons/in-memory-db'; | |
| import { ProductController } from './product.controller'; | |
| @Module({ | |
| imports: [InMemoryDBModule.forFeature('product')], | |
| controllers: [ProductController] | |
| }) | |
| export class ProductModule { |
This file contains hidden or 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 { Controller } from '@nestjs/common'; | |
| import { InMemoryDBService, InMemoryDBEntityAsyncController } from '@nestjs-addons/in-memory-db'; | |
| import { ProductEntity } from './entities/product.entity'; | |
| @Controller('product') | |
| export class ProductController extends InMemoryDBEntityAsyncController<ProductEntity> { | |
| constructor(private productService: InMemoryDBService<ProductEntity>) { | |
| super(productService); | |
| } |