1.0.8 • Published 2 years ago
@corvina/corvina-device-sdk v1.0.8
Installation
Usage in a Nestjs application
In your app module, import the device client module:
import { DeviceClientModule } from '@corvina/corvina-device-sdk';
@Module({
imports: [DeviceClientModule],
controllers: [AppController],
providers: [AppService],
})
export class AppModule {}
In your main.ts
you can start the device using the DeviceRunner
service.
This service reads the configuration from a .env
file.
import { DeviceRunnerService } from '@corvina/corvina-device-sdk';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
app.get(DeviceRunnerService).run();
}
Using in a plain nodejs application
Install @nestjs/common
peer dependency and dotenv
to load .env
into process.env
:
yarn install @nestjs/common dotenv
Run the device using the given runner:
import 'dotenv/config'
import { DeviceRunnerService, DeviceService } from '@corvina/corvina-device-sdk';
const devRunner = new DeviceRunnerService(new DeviceService());
devRunner.run();
Change Log
See Changelog for more information.
Contributing
Contributions welcome! See Contributing.
Author
Arrigo Zanette
License
Licensed under the MIT License - see the LICENSE file for details.