Update Waspleau example and blog post to use new Analyzer syntax (#443)

This commit is contained in:
Shayne Czyzewski 2022-01-31 11:41:47 -05:00 committed by GitHub
parent 43c14c12c1
commit f9ff48824b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 26 deletions

View File

@ -1,17 +1,20 @@
app waspleau { 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 { route RootsRoute { path: "/", to: MainPage }
setupFn: import serverSetup from "@ext/serverSetup.js" page MainPage {
}
db {
system: PostgreSQL
}
route "/" -> page Main
page Main {
component: import Main from "@ext/MainPage.js" component: import Main from "@ext/MainPage.js"
} }
@ -22,8 +25,3 @@ query dashboard {
entity Dummy {=psl entity Dummy {=psl
id Int @id @default(autoincrement()) id Int @id @default(autoincrement())
psl=} psl=}
dependencies {=json
"bull": "4.1.1",
"axios": "^0.21.1"
json=}

View File

@ -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" ```css title="main.wasp"
app waspleau { 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... 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: 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" ```css title="main.wasp"
... app waspleau {
...
server { server: {
setupFn: import serverSetup from "@ext/serverSetup.js" setupFn: import serverSetup from "@ext/serverSetup.js"
}
} }
``` ```