Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: specify httpinboundtransport path #1115

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/node/src/transport/HttpInboundTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ import express, { text } from 'express'
export class HttpInboundTransport implements InboundTransport {
public readonly app: Express
private port: number
private path: string
private _server?: Server

public get server() {
return this._server
}

public constructor({ app, port }: { app?: Express; port: number }) {
public constructor({ app, path, port }: { app?: Express; path?: string; port: number }) {
this.port = port

// Create Express App
this.app = app ?? express()
this.path = path ?? '/'

this.app.use(
text({
Expand All @@ -36,7 +38,7 @@ export class HttpInboundTransport implements InboundTransport {
port: this.port,
})

this.app.post('/', async (req, res) => {
this.app.post(this.path, async (req, res) => {
const session = new HttpTransportSession(utils.uuid(), req, res)
try {
const message = req.body
Expand Down