An easy POST and GET through servers?

Heyo, I am trying to make a simple POST and GET-er on a Workers going in order to make a simple online system working for my project.

I basically want to get one client to post a Hash, String or JSON to the workers and have another client be able to get it. I tried with caching but to no avail.
I just can’t seem to understand how it all works even using the examples that are given didn’t help.

I am using JavaScript and would appreciate a little bit of help as I am determined to get this to work.

Are clients in the same region?

Payload
Client A POST > Worker > Client B GET

Is this what you want? If so you should use durable objects for source of truth.

1 Like

Durable Objects seem very useful from what I can tell from the documentation, but when I do try to use them and try to publish my code I get:

In order to use Durable Objects, you must agree to pricing at https://dash.cloudflare.com/<ID>/workers/overview?enable-durable-objects [API code: 10084]

When I go into my dashboard I already have durable objects enabled. Kind of stuck in a loop here

Found that it had to do with not being on a subscription, so I do now and got a durable object running in my worker, yet I cant seem to figure out how to manipulate the value in a way that also allows another client to get the value.

Currently running this based on the example:

export class PtP {
  constructor(state, env) {
    this.state = state;
  }

  async fetch(request) {
    let value = await this.state.storage.get("value");

    if (request.method === 'POST') {
      value = request.body;
    }
    await this.state.storage.put("value", value);

    return new Response(value);
  }
}

with everything above this just being the default generated fetch and handlerequest methods.