Skip to content

Instantly share code, notes, and snippets.

View santoshyadavdev's full-sized avatar
🏠
making a difference

Santosh Yadav santoshyadavdev

🏠
making a difference
View GitHub Profile
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 {
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 {
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) {
import { InjectionToken } from '@angular/core';
import { Config } from './demo.config';
export const configToken = new InjectionToken<Config>('demo token');
export interface Config {
apiEndPoint: string;
timeout: number;
}
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>) {
}
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 {
import { InMemoryDBEntity } from '@nestjs-addons/in-memory-db';
export interface EmployeeEntity extends InMemoryDBEntity {
name: string;
email: string;
department: string;
age: number;
}
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 {
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);
}