-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1875eeb
commit dfe5d89
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"trailingComma": "all", | ||
"tabWidth": 2, | ||
"semi": true, | ||
"arrowParens": "always", | ||
"printWidth": 120 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "restate-cloudflare-worker-template", | ||
"type": "module", | ||
"version": "0.0.1", | ||
"scripts": { | ||
"deploy": "wrangler deploy", | ||
"dev": "wrangler dev", | ||
"start": "wrangler dev", | ||
"format": "prettier --write \"src/*.+(js|ts|json)\"" | ||
}, | ||
"dependencies": { | ||
"@restatedev/restate-sdk": "dev" | ||
}, | ||
"devDependencies": { | ||
"@cloudflare/workers-types": "^4.20240605.0", | ||
"prettier": "^3.3.2", | ||
"typescript": "^5.4.5", | ||
"wrangler": "^3.0.0" | ||
}, | ||
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Context, endpoint, service } from "@restatedev/restate-sdk/cloudflare"; | ||
|
||
// Template of a Restate service and handler | ||
// | ||
// Have a look at the TS QuickStart to learn how to run this: https://docs.restate.dev/get_started/quickstart?sdk=ts | ||
// | ||
|
||
const greet = async (ctx: Context, greeting: string) => { | ||
return `${greeting}!`; | ||
}; | ||
|
||
export default endpoint() | ||
.bind( | ||
service({ | ||
name: "Greeter", | ||
handlers: { greet }, | ||
}), | ||
) | ||
.handler(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"compilerOptions": { | ||
"noEmit": true, | ||
"module": "esnext", | ||
"target": "esnext", | ||
"lib": ["esnext"], | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"types": ["@cloudflare/workers-types"] | ||
}, | ||
"exclude": ["node_modules", "dist", "test"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name = "restate-cloudflare-worker" | ||
main = "./src/index.ts" | ||
compatibility_date = "2024-05-13" | ||
compatibility_flags = [ "nodejs_compat" ] |