本文整理匯總了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: {