Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Application
✓ import { Application } from 'mikudos-node-app'
✗ const { Application } = require('mikudos-node-app'); // works but ESM preferred
Primary class; ESM or CJS both supported.
Service
✓ import { Service } from 'mikudos-node-app'
✗ import Service from 'mikudos-node-app'; // default export not available
Named export, decorator for service class.
App
✓ import { App } from 'mikudos-node-app'
✗ import { App } from 'mali'; // wrong package
Parameter decorator to inject Application instance.
Customer
✓ import { Customer } from 'mikudos-node-app'
✗ import { Customer } from 'customer'; // not an external package
Custom parameter decorator for injectable values.
Minimal gRPC server with decorator-based service registration, hooks, and parameter injection.
import * as path from 'path';
import { Application, Service, Method, HookMethod, HookService, App, Customer } from 'mikudos-node-app';
const PROTO_PATH = path.resolve(__dirname, './example.proto');
const app = new Application(PROTO_PATH);
@Service({ name: 'GreeterService', serviceName: 'GreeterService' })
@HookService('before', async (ctx, next) => { console.log('service hook'); await next(); })
export class Greeter {
constructor(@App() private app: Application, @Customer('test') private test: any) {}
@Method('SayHello')
@HookMethod('before', async (ctx, next) => { console.log('method hook'); await next(); })
async SayHello(ctx: any, next: Function) {
ctx.res = { message: 'Hello ' + ctx.req.name };
next();
}
}
app.register(Greeter);
app.start('0.0.0.0:50051');
console.log('Server running on 0.0.0.0:50051');
Errors
Common errors & fixes
Error: Cannot find module 'grpc'
Missing peer dependency 'grpc'.
TypeError: Class constructor Application cannot be invoked without 'new'
Using 'require' without destructuring or calling constructor incorrectly.
fixUse correct import: const { Application } = require('mikudos-node-app'); TypeError: (0 , _mikudosNodeApp.Service) is not a function
Decorator not transpiled; missing 'experimentalDecorators' in tsconfig.json.
fixAdd 'experimentalDecorators': true to tsconfig.json compilerOptions.
Audit
Dependencies
grpcrequiredPeer dependency required for gRPC functionality