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 {
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=}

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"
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"
}
}
```