Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function bootstrap() {
const HTTP_PORT = parseInt(process.env.HTTP_PORT, 10) || 3000; // Default to 3000
const GRPC_PORT = parseInt(process.env.GRPC_PORT, 10) || 4000; // Default to 4000
const app = await NestFactory.create(PostModule);
app.connectMicroservice({
transport: Transport.GRPC,
options: {
url: `0.0.0.0:${GRPC_PORT}`,
package: 'post',
protoPath: join(__dirname, 'src/grpc/post.proto'),
},
});
app.connectMicroservice({
transport: Transport.REDIS,
options: {
url: process.env.REDIS_HOST,
},
});
async function bootstrap() {
const HTTP_PORT = parseInt(process.env.HTTP_PORT, 10) || 3000; // Default to 3000
const GRPC_PORT = parseInt(process.env.GRPC_PORT, 10) || 4000; // Default to 4000
const app = await NestFactory.create(SearchModule);
app.connectMicroservice({
transport: Transport.GRPC,
options: {
url: `0.0.0.0:${GRPC_PORT}`,
package: 'search',
protoPath: join(__dirname, 'src/grpc/search.proto'),
},
});
await app.startAllMicroservicesAsync();
await app.listen(HTTP_PORT);
}
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule, expressApp);
app.setGlobalPrefix('api');
app.use(cors());
app.use(bodyParser.json());
app.use(expressJWT({ secret: process.env.JWT_SWECRET }).unless({ path: '/api/auth/authenticate' }), (error, req, res, next) => {
if (error.name === 'UnauthorizedError') {
res.status(HttpStatus.UNAUTHORIZED).json({
message: error.message
});
}
});
await app.listen(process.env.PORT, () => {
console.log('APP is listening on port ' + process.env.PORT);
});
}
bootstrap();
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const ruleEngine = app.get(RuleEngineService);
const rules = [];
rules.push(ruleEngine.register(TestRule));
rules.push(
new RuleBuilder()
.name('test2')
.priority(1)
.when(async () => true)
.then(async () => console.log('test2 action'))
.build(),
);
await ruleEngine.fire(rules, { value: 'test' });
async function bootstrap(): Promise {
config();
const instance = express();
instance.use(cors());
instance.use('/uploads', express.static('uploads'));
const nestApp = await NestFactory.create(ApplicationModule, instance);
nestApp.useGlobalInterceptors(new ResponseInterceptor());
nestApp.useGlobalFilters(new RequestExceptionFilter(), new DefaultExceptionFilter());
nestApp.useGlobalPipes(new ValidatorPipe());
nestApp.useGlobalGuards(new RolesGuard(new Reflector()));
const server = await nestApp.listen(parseInt(process.env.API_PORT, 10));
console.info(`Application is listening on port ${process.env.API_PORT}.`);
return server;
}
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();
async function bootstrap() {
const app = await NestFactory.create(ApiModule);
await app.listen(3000);
}
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3002);
}
bootstrap();
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
bootstrap();
async function bootstrap() {
const RedisStore = Store(session);
const app = await NestFactory.create(AppModule);
app.use(
session({
store: new RedisStore({
client: redis as any,
}),
name: 'votingapp',
secret: SESSION_SECRET,
resave: false,
saveUninitialized: false,
cookie: {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
expires: true,
maxAge: 1000 * 60 * 60 * 24 * 365,
},
}),