# Hello world

Return a fixed string directly from a function, without contacting an origin server. This is the smallest form of the pattern every function follows, which makes it a useful check that a function is deployed and serving traffic before you add logic to it.

```js
  async function handleRequest(request) {
    return new Response(" Functions JavaScript - General Availability")
  }
  
  addEventListener("fetch", event => {
    return event.respondWith(handleRequest(event.request))
  })
```

## How it works

The function registers a handler for the `fetch` event with `addEventListener`. When a request arrives, `handleRequest` builds a new `Response` containing the text to return, and `event.respondWith()` sends that response back to the client. Because the code runs on Azion's distributed infrastructure, the response is delivered close to the user, with no request to an origin.

The same pattern returns any kind of content. Change the value passed to `Response` for a different body, and set a `content-type` header when the body is HTML or JSON.

## Related resources

- [JavaScript examples](/en/documentation/platform/functions/javascript-examples.md): Browse the rest of the snippets in this collection.
- [FetchEvent](/en/documentation/devtools/runtime/api-reference/fetch-event.md): Read the reference for the event this handler listens to, including `respondWith()`.
- [Response](/en/documentation/devtools/runtime/api-reference/response.md): Check the status, headers, and body options the constructor accepts.
- [How Functions works](/en/documentation/platform/functions/how-it-works.md): See what has to exist before a function runs on a request.
- [Functions limits](/en/documentation/platform/functions/limits.md): The ceilings a single invocation of this function runs inside, and the ones that vary by plan.
- [Quickstart](/en/documentation/platform/functions/quickstart.md): What an account needs before a function can run, and the steps that put one in the path of a request.
