0.1.0-alpha.4 • Published 2 years ago

@doubleshot/nest-electron-ipc-transport v0.1.0-alpha.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@doubleshot/nest-electron-ipc-transport

Description

It is an electron ipc transport for nestjs that provides simple ipc communication.

Warning: this project is in early stage, do not use in production environment

Install

npm i @doubleshot/nest-electron-ipc-transport
# Or Yarn
yarn add @doubleshot/nest-electron-ipc-transport
# Or PNPM
pnpm add @doubleshot/nest-electron-ipc-transport

Usage

Nestjs main file:

import { NestFactory } from '@nestjs/core'
import type { MicroserviceOptions } from '@nestjs/microservices'
import { app } from 'electron'
import { ElectronIpcTransport } from '@doubleshot/nest-electron-ipc-transport'
import { AppModule } from './app.module'

async function bootstrap() {
  try {
    await app.whenReady()

    const nestApp = await NestFactory.createMicroservice<MicroserviceOptions>(
      AppModule,
      {
        strategy: new ElectronIpcTransport(),
      },
    )

    await nestApp.listen()
  }
  catch (error) {
    app.quit()
  }
}

bootstrap()

This transport depends on the nestjs microservice, so you have to install it first:

pnpm install @nestjs/microservices

License

MIT License © 2022 Archer Gu