32 lines
767 B
TypeScript
32 lines
767 B
TypeScript
import { i18n } from './i18n'
|
|
import { sdk } from './sdk'
|
|
import { appPort } from './utils'
|
|
|
|
export const setInterfaces = sdk.setupInterfaces(async ({ effects }) => {
|
|
const host = sdk.MultiHost.of(effects, 'api')
|
|
const origin = await host.bindPort(appPort, {
|
|
protocol: 'http',
|
|
preferredExternalPort: 80,
|
|
addSsl: {
|
|
alpn: { specified: ['http/1.1'] },
|
|
preferredExternalPort: 443,
|
|
addXForwardedHeaders: true,
|
|
auth: null,
|
|
},
|
|
})
|
|
|
|
const api = sdk.createInterface(effects, {
|
|
name: i18n('Todo API'),
|
|
id: 'api',
|
|
description: i18n('REST API for todo items'),
|
|
type: 'api',
|
|
masked: false,
|
|
schemeOverride: null,
|
|
username: null,
|
|
path: '/',
|
|
query: {},
|
|
})
|
|
|
|
return [await origin.export([api])]
|
|
})
|