本文整理汇总了TypeScript中gearworks.Server.connection方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Server.connection方法的具体用法?TypeScript Server.connection怎么用?TypeScript Server.connection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gearworks.Server
的用法示例。
在下文中一共展示了Server.connection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: registerPlugins
import {RoutesToRegister} from "./routes/index";
import {defaults, isError, merge} from "lodash";
import {Server, ServerApp, DefaultContext} from "gearworks";
import {DefaultTTL, CacheName, registerCaches} from "./modules/cache";
//Prepare Hapi server
const server: Server = new Hapi.Server() as Server;
const serverConfig: Hapi.IServerConnectionOptions = {
port: config.Port || 3000,
host: config.Host || "localhost",
router: {
isCaseSensitive: false,
stripTrailingSlash: true
}
};
const connection = server.connection(serverConfig);
async function registerPlugins()
{
//Inert gives Hapi static file and directory handling via reply.file and reply.directory.
await server.register(require("inert"));
//Adds async support to Hapi route handlers.
await server.register(require("hapi-async-handler"));
//Yar is a cookie management plugin for Hapi.
await server.register({
register: require("yar"),
options: {
storeBlank: false,
cookieOptions: {