-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* example for typescript using ts4w https://www.npmjs.com/package/ts4w * add test - it's failign though * dependnecies * Apply suggestions from code review Co-authored-by: Mark McCulloh <[email protected]> * obsolete * relative files have to reference statically, with an absolute path * Update to most recent version * Add simple readme * Adapt gh workflow to ts --------- Co-authored-by: Mark McCulloh <[email protected]>
- Loading branch information
1 parent
c812994
commit 2c1b7bd
Showing
6 changed files
with
5,556 additions
and
2 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
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,5 @@ | ||
# Wing Typescript Example | ||
|
||
This is based on the [Wing Typescript SDK](https://www.winglang.io/docs/typescript/) and demonstrates a simple function with testing. | ||
|
||
The [my-ssr-framework.ts](./my-ssr-framework.ts) part could be easily swapped by something like [hono](https://hono.dev/) or [remix](https://remix.run/). |
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 { cloud, lift, main } from "@wingcloud/framework"; | ||
import { myServer } from "./my-ssr-framework"; | ||
import assert from "node:assert"; | ||
|
||
main((root, test) => { | ||
let bucket = new cloud.Bucket(root, "Bucket"); | ||
|
||
bucket.addObject("hello", "Hello World from lifted Bucket!"); | ||
|
||
new cloud.Function(root, "hello", lift({bucket}).inflight(async ({bucket}) => { | ||
const result = await myServer({bucket}) | ||
return result; | ||
})); | ||
|
||
test("testing it works", lift({bucket}).inflight(async ({bucket}) => { | ||
const result = await myServer({bucket}) | ||
assert.equal(result , "Hello World from lifted Bucket!"); | ||
})) | ||
}) |
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 @@ | ||
import { cloud } from "@wingcloud/framework"; | ||
|
||
export const myServer = async ({bucket}: { bucket: cloud.IBucketClient }) => { | ||
const file = await bucket.get("hello"); | ||
console.log(file); | ||
return file; | ||
} |
Oops, something went wrong.