From f9ff48824bb6e4a269d1c8b2e2fdfe2a729c9857 Mon Sep 17 00:00:00 2001 From: Shayne Czyzewski Date: Mon, 31 Jan 2022 11:41:47 -0500 Subject: [PATCH] Update Waspleau example and blog post to use new Analyzer syntax (#443) --- examples/waspleau/main.wasp | 30 ++++++++++++++---------------- web/blog/2022-01-27-waspleau.md | 21 +++++++++++---------- 2 files changed, 25 insertions(+), 26 deletions(-) diff --git a/examples/waspleau/main.wasp b/examples/waspleau/main.wasp index 6cf7db39f..92f74709c 100644 --- a/examples/waspleau/main.wasp +++ b/examples/waspleau/main.wasp @@ -1,17 +1,20 @@ app waspleau { - title: "Waspleau" + title: "Waspleau", + + server: { + setupFn: import serverSetup from "@ext/serverSetup.js" + }, + + db: { system: PostgreSQL }, + + dependencies: [ + ("bull", "4.1.1"), + ("axios", "^0.21.1") + ] } -server { - setupFn: import serverSetup from "@ext/serverSetup.js" -} - -db { - system: PostgreSQL -} - -route "/" -> page Main -page Main { +route RootsRoute { path: "/", to: MainPage } +page MainPage { component: import Main from "@ext/MainPage.js" } @@ -22,8 +25,3 @@ query dashboard { entity Dummy {=psl id Int @id @default(autoincrement()) psl=} - -dependencies {=json - "bull": "4.1.1", - "axios": "^0.21.1" -json=} diff --git a/web/blog/2022-01-27-waspleau.md b/web/blog/2022-01-27-waspleau.md index 5e0406860..d803c5c1e 100644 --- a/web/blog/2022-01-27-waspleau.md +++ b/web/blog/2022-01-27-waspleau.md @@ -36,14 +36,13 @@ So, what do we need to get started? First, we need a way to schedule and run job ```css title="main.wasp" app waspleau { - title: "Waspleau" + title: "Waspleau", + + dependencies: [ + ("bull", "4.1.1"), + ("axios", "^0.21.1") + ] } - -... - -dependencies {=json - "bull": "4.1.1" -json=} ``` But where do we declare our queue and processing callback functions in Wasp? Uh oh... @@ -55,10 +54,12 @@ But where do we declare our queue and processing callback functions in Wasp? Uh Thankfully, Waspleau can leverage a powerful and flexible [hook supplied by Wasp](https://wasp-lang.dev/docs/language/basic-elements#setupfn) called `server.setupFn`. This declares a JavaScript function that will be executed on server start. Yahoo! This means we can do things like the following: ```css title="main.wasp" -... +app waspleau { + ... -server { - setupFn: import serverSetup from "@ext/serverSetup.js" + server: { + setupFn: import serverSetup from "@ext/serverSetup.js" + } } ```