question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not attach 'request' listener if custom http server is provided

See original GitHub issue

When I’m passing a custom HTTP server to Logux I would like to have full control over my routes.

import { Server as LoguxServer } from '@logux/server'
import http from 'http'
import polka from 'polka'

const server = http.createServer()

const app = polka({ server })
app.get('/status', (req, res) => res.end('OK'))

const loguxServer = new LoguxServer()

app.listen()
await loguxServer.listen()

This doesn’t work and I have to detach it manually.

await loguxServer.listen()

let [polkaListener, loguxListener] = server.listeners('request')
server.off('request', loguxListener as any)

https://github.com/logux/server/blob/main/base-server/index.js#L400

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aicommented, Jun 2, 2022

We can add ignoreNonWsRequest (I will think about a better name) to Server options.

0reactions
aicommented, Jul 19, 2022

Another way to test it just to copy-paste files from the repo to node_modules/@logux/server

Read more comments on GitHub >

github_iconTop Results From Across the Web

http.server — HTTP servers — Python 3.11.1 documentation
BaseHTTPRequestHandler provides a number of class and instance variables, and methods for use by subclasses. The handler will parse the request and the...
Read more >
How To Make an HTTP Server in Go | DigitalOcean
In this tutorial, you will create an HTTP server using Go's standard library and then expand your server to read data from the...
Read more >
Configure HTTP Listener Source - Mule 4
The Anypoint Connector for HTTP (HTTP Connector) Listener source enables you to set up an HTTP server and trigger flows when receiving HTTP...
Read more >
HttpServer (Java HTTP Server ) - Oracle Help Center
This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number and listens for incoming TCP...
Read more >
HTTP | Node.js v19.3.0 Documentation
Emitted each time a server responds to a request with a CONNECT method. If this event is not being listened for, clients receiving...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found