本文整理汇总了TypeScript中gulp-connect.server函数的典型用法代码示例。如果您正苦于以下问题:TypeScript server函数的具体用法?TypeScript server怎么用?TypeScript server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了server函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: log
gulp.task('backend', (done) => {
connect.server({
root : [config.source('')],
port : config.serverPort + 1,
middleware: () => {
const middleware = [bodyparser.json() as NextHandleFunction]
if (proxy.server == null) {
log('No proxy server exists, will use StubAPI mode.')
const msm = new MSM({
apiPrefixes : config.apiPrefixes,
apiDir : 'stubapi/',
lowerCase : true,
ping : config.ping,
preserveQuery: false,
logLevel : 'DEBUG',
})
middleware.push(msm.middleware())
} else {
log('Existing proxy server found, will use proxy mode.')
middleware.push(proxyMiddlewareFactory(proxy.server))
}
return middleware
},
})
done()
})
示例2:
gulp.task("connect", () => {
connect.server({
root: Paths.DistDirectory,
livereload: true,
port: 8888,
https: false
});
});
示例3: middleware
gulp.task('connect', () => {
connect.server({
root: "app",
middleware(connect, opt) {
return [];
}
});
});
示例4:
gulp.task('connectDist', () => {
connect.server({
name: 'Dist App',
root: 'dist',
port: 8001,
livereload: true
});
});
示例5: task
task('demos.serve', function() {
connect.server({
root: './',
port: LOCAL_SERVER_PORT,
livereload: {
port: 35700
}
});
});
示例6: express
gulp.task('connect', () => {
const middleware = [
express()
];
return connect.server({
root: [__dirname],
port: 8081,
livereload: true,
middleware: (connect, opt) => middleware
});
});
示例7:
gulp.task('connect', () => {
connect.server({
livereload: true,
root: ['./www']
});
});