https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • w

    Walshy | Pages

    02/02/2021, 11:42 AM
    This doesn't do any convertion. This is just showing off running a worker using PHP instead of JS
  • w

    Walshy | Pages

    02/02/2021, 11:42 AM
    Oh nevermind, the babel is converting the PHP to JS
  • p

    Poli

    02/02/2021, 11:42 AM
    Ah I see but what I don't understand as well here is that you need to use some returns? https://github.com/cloudflare/php-worker-hello-world/blob/master/index.php You cannot simply push a code with a basic echo "hello world"?
  • p

    Poli

    02/02/2021, 11:43 AM
    no worries
  • w

    Walshy | Pages

    02/02/2021, 11:44 AM
    Yeah, so, this is a worker meaning it will handle incoming requests. It isn't just a server to render PHP. If you wanted a simple plain text response of "hello world" you'd have to return a Response with that
  • p

    Poli

    02/02/2021, 11:45 AM
    Mhmm I see so everything needs a return with the function written in the script? But will the workers still run the PHP or I will need another machine in the backend
  • w

    Walshy | Pages

    02/02/2021, 11:45 AM
    These sit on the edge and are done before it hits your origin server. You can do responses, request modification or even HTML modification of the origin
  • p

    Poli

    02/02/2021, 11:45 AM
    ah really nice
  • w

    Walshy | Pages

    02/02/2021, 11:45 AM
    You don't need to return a Response, you can just modify something like the headers and let the request go to the origin server
  • w

    Walshy | Pages

    02/02/2021, 11:46 AM
    The workers site explains it well:
  • p

    Poli

    02/02/2021, 11:46 AM
    because I am only using it to be not pure html coded like for languages so that it automatically does it
  • p

    Poli

    02/02/2021, 11:46 AM
    I will check more in detail
  • p

    Poli

    02/02/2021, 11:46 AM
    thanks for the lights
  • p

    Poli

    02/02/2021, 11:48 AM
    Is doing two echos considered as two requests?
  • p

    Poli

    02/02/2021, 11:49 AM
    On the same page
  • w

    Walshy | Pages

    02/02/2021, 11:49 AM
    I'm not sure what doing echo will do at all. It may just print to console, I couldn't tell you if you wanted to return content (instead of it going to the origin server) you need to return a response. You can't return 2 of those.
  • j

    joe

    02/02/2021, 12:36 PM
    hahaha wait there is a Cloudflare PoP on Réunion island? (re: #770297010619416586)
  • j

    joe

    02/02/2021, 12:36 PM
    that's awesome
  • i

    itsmatteomanf

    02/02/2021, 2:02 PM
    Yup!
  • d

    Deleted User

    02/02/2021, 2:15 PM
    Good day CF, I work for a company that have an Enterprise contract and might be interested in the waiting room if it integrates with workers - is there plans to expose a Waiting Room context to CF workers? if so, what would be in that context?
  • s

    stexxart

    02/02/2021, 2:50 PM
    Does anyone know if there are plans to provide a better experience for querying a SQL database? I'm aware of
    db-connect
    but it's experimental and requires an Argo Tunnel. We've built a geographically-distributed CockroachDB (which requires a PostgreSQL-compatible driver) database, but Workers doesn't seem to be well supported for this kind of application.
  • w

    Walshy | Pages

    02/02/2021, 3:03 PM
    I would assume it's possible. You'd just need to have the package and use webpack to bundle. I can't say for sure though
  • s

    stexxart

    02/02/2021, 3:14 PM
    I'm not sure if you're replying to my message above. Although, I read that arbitrary TCP connections are not possible from a Cloudflare Worker. Will this change? Most open-source SQL databases require connections over TCP.
  • w

    Walshy | Pages

    02/02/2021, 3:16 PM
    Ah right yeah. Yeah, I have no idea if there's any plans to change that.
  • d

    Deleted User

    02/02/2021, 6:06 PM
    yeah - even better - would be great to kind of hook into returning content types. So if the content type is text/html, do this - although that is very tricky. 🙂
  • d

    Deleted User

    02/02/2021, 6:07 PM
    You don't get control over the actual request - response cycle then, only a callback to execute against the doc.
  • d

    Deleted User

    02/02/2021, 6:08 PM
    Actually, disregard that - horrible idea 😛
  • w

    Walshy | Pages

    02/02/2021, 6:10 PM
    modify if the response is text/html?
  • w

    Walshy | Pages

    02/02/2021, 6:11 PM
    shouldn't be that hard actually
  • w

    Walshy | Pages

    02/02/2021, 6:11 PM
    you just do a sub-request and then use HTMLRewriter
1...808182...2509Latest