Skip to content

Commit

Permalink
refactor: move http server setup to separate function
Browse files Browse the repository at this point in the history
  • Loading branch information
dnalborczyk committed Aug 1, 2022
1 parent 78fd105 commit 6f03251
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ServerlessOffline.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ export default class ServerlessOffline {

this.#http = new Http(this.#serverless, this.#options, this.#lambda)

this.#http.createServer()

await this.#http.registerPlugins()

this.#http.create(events)
Expand Down
4 changes: 4 additions & 0 deletions src/events/http/Http.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export default class Http {
return this.#httpServer.stop(timeout)
}

createServer() {
this.#httpServer.createServer()
}

#createEvent(functionKey, rawHttpEventDefinition, handler) {
const httpEvent = new HttpEventDefinition(rawHttpEventDefinition)

Expand Down
2 changes: 2 additions & 0 deletions src/events/http/HttpServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export default class HttpServer {
this.#lambda = lambda
this.#options = options
this.#serverless = serverless
}

createServer() {
const {
enforceSecureCookies,
host,
Expand Down

0 comments on commit 6f03251

Please sign in to comment.