mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-24 01:22:24 +03:00
Update Waspleau example and blog post to use new Analyzer syntax (#443)
This commit is contained in:
parent
43c14c12c1
commit
f9ff48824b
@ -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=}
|
||||
|
@ -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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user