本文整理汇总了TypeScript中@nestjs/core.NestFactory类的典型用法代码示例。如果您正苦于以下问题:TypeScript NestFactory类的具体用法?TypeScript NestFactory怎么用?TypeScript NestFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NestFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: bootstrap
async function bootstrap() {
//創建express 實例
const instance = express();
//middleware
instance.use(bodyParser.json());
instance.use(bodyParser.urlencoded({ extended: false }));
//NestFactory.create()接受一個模組引數,和一個可選的express實例引數,並返回Promise。
const app = await NestFactory.create(ApplicationModule, instance);
//swagger options
const options = new DocumentBuilder()
.setTitle('Users Restful API')
.setDescription('The users Restful API description')
.setVersion('1.0')
.addTag('users')
.build();
//restful API 文檔
const document = SwaggerModule.createDocument(app, options);
//打開http://localhost/api 就會連結到swagger服務。
SwaggerModule.setup('/api', app, document);
await app.listen(3000)
}
开发者ID:fanybook,项目名称:Nestjs30Days,代码行数:25,代码来源:server.ts
示例2: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(
session({
secret:'No sera de tomar un traguito',
resave: false,
saveUninitialized: true,
cookie: {secure: false},
name: 'server-session-id',
store: new FileStore()
})
);
app.use(cookieParser(
'me gustan los tacos', // secreto
{ // opciones
}
));
app.set('view engine', 'ejs');
app.use(
express.static('publico')
);
await app.listen(3000);
}
开发者ID:2018-B-GR1-AplicacionesWeb,项目名称:huertas-cuastumal-jimmy-andres,代码行数:27,代码来源:main.ts
示例3: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(
express.static('publico')
);
await app.listen(3000);
}
开发者ID:2018-B-GR1-AplicacionesWeb,项目名称:caiza-llumitaxi-jonathan-paul,代码行数:7,代码来源:main.ts
示例4: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
logger: console,
cors: true,
});
await app.useWebSocketAdapter(new WsAdapter(app)).listen(port);
}
开发者ID:fischermatte,项目名称:geolud,代码行数:7,代码来源:main.ts
示例5: bootstrap
async function bootstrap(): Promise<any> {
const app = await NestFactory.create(ApplicationModule, instance);
/* App filters. */
app.useGlobalFilters(new DispatchErrorFilter());
/* End of app filters. */
await app.listen(3000);
}
开发者ID:wxyyxc1992,项目名称:WXWeChatToolkits,代码行数:7,代码来源:server.ts
示例6: bootstrap
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(M1cr0blogModule, { cors: true })
// Set up static content rendering
app.useStaticAssets(__dirname + '/static')
app.setBaseViewsDir(__dirname + '/views')
app.setViewEngine('hbs')
hbs.registerPartials(__dirname + '/views/partials')
hbs.registerHelper('unlessEquals', function(arg1, arg2, options) {
//@ts-ignore
return (arg1 != arg2) ? options.fn(this) : options.inverse(this);
})
hbs.registerHelper('replace', function(needle: string, newstr: string, options) {
//@ts-ignore
return options.fn(this).replace(needle, newstr)
})
// Set up Swagger
const options = new DocumentBuilder()
.setTitle('M1cr0blog API')
.setDescription('Backend REST API for m1cr0man\'s blog')
.setVersion('1.0')
.addTag('Users', 'User management system')
.addBearerAuth()
.build()
const document = SwaggerModule.createDocument(app, options)
SwaggerModule.setup('api/swagger', app, document)
await app.listen(3000)
}
开发者ID:m1cr0man,项目名称:m1cr0blog,代码行数:30,代码来源:index.ts
示例7: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cors());
app.useStaticAssets(join(__dirname, '..', 'public'));
await app.listen(app.get(ConfigService).port);
}
开发者ID:mbechev,项目名称:Feedback,代码行数:7,代码来源:main.ts
示例8: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cookieParser('Max super perro',//secreto
{
//opciones
}));
await app.listen(3000);
}
开发者ID:2018-B-GR1-AplicacionesWeb,项目名称:Beltran-Venegas-Daniel-Alexander,代码行数:8,代码来源:main.ts
示例9: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cookieParser('me gusta los tacos',
{
}
));
await app.listen(3000);
}
开发者ID:2018-B-GR1-AplicacionesWeb,项目名称:Cargua-Vila-a-Ronald-Stalin,代码行数:9,代码来源:main.ts
示例10: bootstrap
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
app.useStaticAssets(join(__dirname, '..', 'public'));
app.setBaseViewsDir(join(__dirname, '..', 'views'));
app.setViewEngine('hbs');
await app.listen(3000);
}
开发者ID:SARAVANA1501,项目名称:nest,代码行数:9,代码来源:main.ts
示例11: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cookieParser(
'me gustan los tacos', //secreto
{//opciones
}
));
await app.listen(3000); //puerto en el que se levanta el servidor
}
开发者ID:2018-B-GR1-AplicacionesWeb,项目名称:Chinacalle-Paredes-Analy-Belen,代码行数:9,代码来源:main.ts
示例12: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule, new FastifyAdapter());
await app.listen(3000);
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => app.close());
}
}
开发者ID:ARCturus1,项目名称:NestMarket,代码行数:9,代码来源:main.hmr.ts
示例13: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cookieParser('me gusta el yahuarlocro',//secreto
{
//opciones
}));
app.set('view engine','ejs');//renderizar
await app.listen(3000);
}
开发者ID:RenatoJavi,项目名称:salazar-espinosa-renato-javier,代码行数:9,代码来源:main.ts
示例14: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
const options = new DocumentBuilder()
.setTitle("Blog API")
.setDescription("Back office, for a blog API")
.setVersion("1.0")
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("docs", app, document);
await app.listen(configService.getNumber("PORT"));
}
开发者ID:jonathan-patalano,项目名称:blog-api,代码行数:11,代码来源:main.ts
示例15: async
export const startServer = async (appRootPath: string) => {
const app = await NestFactory.create(
AppModule.forRoot({
appHomeDirPath,
appRootPath
})
);
await app.listen(SERVER_PORT, () => {
console.log(`Server started at port ${SERVER_PORT}`);
});
};
开发者ID:pschild,项目名称:image-management-tool,代码行数:11,代码来源:server.ts
示例16: bootstrap
async function bootstrap() {
const { graphqlUploadExpress } = require('graphql-upload');
const app = await NestFactory.create(AppModule);
app.useStaticAssets(join(__dirname, '../storage'), {prefix: '/storage/'});
app.useStaticAssets(join(__dirname, '../web-app'));
app.enableCors();
app.use(graphqlUploadExpress());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
await app.listen(5000);
}
开发者ID:ngocdiep,项目名称:nd,代码行数:11,代码来源:main.ts
示例17: bootstrap
async function bootstrap() {
//創建express 實例
const instance = express();
//middleware
instance.use(bodyParser.json());
instance.use(bodyParser.urlencoded({ extended: false }));
//NestFactory.create()接受一個模組引數,和一個可選的express實例引數,並返回Promise。
const app = await NestFactory.create(ApplicationModule, instance);
await app.listen(3000)
}
开发者ID:fanybook,项目名称:Nestjs30Days,代码行数:11,代码来源:server.ts
示例18: bootstrap
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.use(cookieParser(
'me gustan los tacos', // secreto
{ // opciones
}
));
app.set('view engine', 'ejs');
await app.listen(3000);
}
开发者ID:2018-B-GR1-AplicacionesWeb,项目名称:alvarez-naranjo-miguel-esteban,代码行数:12,代码来源:main.ts
示例19: bootstrap
async function bootstrap() {
const nuxt = new Nuxt(config);
nuxt.render.unless = unless;
if (config.dev) {
const builder = new Builder(nuxt);
await builder.build();
}
const app = await NestFactory.create(AppModule);
app.use(nuxt.render.unless({ path: /api\// }));
await app.listen(3000);
}
开发者ID:Audiowho,项目名称:audiowho-gallery,代码行数:13,代码来源:main.ts
示例20: bootstrap
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
const port = process.env.PORT || 3000;
app.useStaticAssets(join(__dirname, '..', 'public'));
app.setBaseViewsDir(join(__dirname, '..', 'views'));
app.setViewEngine('hbs');
app.enable('trust proxy');
await app.listen(port);
console.log('Listening on port', port);
}
开发者ID:rummik,项目名称:9k1.us,代码行数:13,代码来源:main.ts
注:本文中的@nestjs/core.NestFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论