Skip to content
File

Blob: samples/hello-wasm/config.capnp

1.7 KB
1# Imports the base schema for workerd configuration files.
2 
3# Refer to the comments in /src/workerd/server/workerd.capnp for more details.
4 
5using Workerd = import "/workerd/workerd.capnp";
6 
7# A constant of type Workerd.Config defines the top-level configuration for an
8# instance of the workerd runtime. A single config file can contain multiple
9# Workerd.Config definitions and must have at least one.
10const helloWasmExample :Workerd.Config = (
11 
12 # Every workerd instance consists of a set of named services. A worker, for instance,
13 # is a type of service. Other types of services can include external servers, the
14 # ability to talk to a network, or accessing a disk directory. Here we create a single
15 # worker service. The configuration details for the worker are defined below.
16 services = [ (name = "main", worker = .helloWasm) ],
17 
18 # Every configuration defines the one or more sockets on which the server will listene.
19 # Here, we create a single socket that will listen on localhost port 8080, and will
20 # dispatch to the "main" service that we defined above.
21 sockets = [ ( name = "http", address = "*:8080", http = (), service = "main" ) ]
22);
23 
24# The definition of the actual helloWasm worker exposed using the "main" service.
25# In this example the worker is implemented as a single simple script (see worker.js).
26# The compatibilityDate is required. For more details on compatibility dates see:
27# https://developers.cloudflare.com/workers/platform/compatibility-dates/
28 
29const helloWasm :Workerd.Worker = (
30 modules = [
31 ( name = "entrypoint", esModule = embed "./build/worker/shim.mjs" ),
32 ( name = "./index.wasm", wasm = embed "./build/worker/index.wasm" )
33 ],
34 compatibilityDate = "2023-03-14",
35);