mirror of
https://github.com/wasp-lang/wasp.git
synced 2024-12-26 10:35:04 +03:00
218 lines
5.5 KiB
JavaScript
218 lines
5.5 KiB
JavaScript
app todoApp {
|
|
wasp: {
|
|
version: "^0.14.0"
|
|
},
|
|
title: "ToDo App",
|
|
auth: {
|
|
userEntity: User,
|
|
methods: {
|
|
email: {
|
|
fromField: {
|
|
name: "ToDO App",
|
|
email: "mihovil@ilakovac.com"
|
|
},
|
|
emailVerification: {
|
|
getEmailContentFn: import { getVerificationEmailContent } from "@src/server/auth/email.js",
|
|
clientRoute: EmailVerificationRoute,
|
|
},
|
|
passwordReset: {
|
|
getEmailContentFn: import { getPasswordResetEmailContent } from "@src/server/auth/email.js",
|
|
clientRoute: PasswordResetRoute
|
|
}
|
|
},
|
|
google: {}
|
|
},
|
|
onAuthFailedRedirectTo: "/login",
|
|
onAuthSucceededRedirectTo: "/profile",
|
|
onBeforeSignup: import { onBeforeSignup } from "@src/auth/hooks.js",
|
|
onAfterSignup: import { onAfterSignup } from "@src/auth/hooks.js",
|
|
},
|
|
server: {
|
|
setupFn: import setup from "@src/server/serverSetup.js",
|
|
middlewareConfigFn: import { serverMiddlewareFn } from "@src/server/serverSetup.js"
|
|
},
|
|
client: {
|
|
rootComponent: import { App } from "@src/client/App.tsx",
|
|
setupFn: import setup from "@src/client/clientSetup.js"
|
|
},
|
|
db: {
|
|
seeds: [
|
|
import { devSeedSimple } from "@src/server/dbSeeds.js",
|
|
import { prodSeed } from "@src/server/dbSeeds.js"
|
|
]
|
|
},
|
|
emailSender: {
|
|
provider: SMTP,
|
|
defaultFrom: {
|
|
email: "mihovil@ilakovac.com"
|
|
},
|
|
},
|
|
}
|
|
|
|
route SignupRoute { path: "/signup", to: SignupPage }
|
|
page SignupPage {
|
|
component: import Signup from "@src/client/pages/auth/Signup.tsx"
|
|
}
|
|
|
|
route LoginRoute { path: "/login", to: LoginPage }
|
|
page LoginPage {
|
|
component: import Login from "@src/client/pages/auth/Login.tsx"
|
|
}
|
|
|
|
route PasswordResetRoute { path: "/password-reset", to: PasswordResetPage }
|
|
page PasswordResetPage {
|
|
component: import { PasswordReset } from "@src/client/pages/auth/PasswordReset.tsx",
|
|
}
|
|
|
|
route EmailVerificationRoute { path: "/email-verification-", to: EmailVerificationPage }
|
|
page EmailVerificationPage {
|
|
component: import { EmailVerification } from "@src/client/pages/auth/EmailVerification.tsx",
|
|
}
|
|
|
|
route RequestPasswordResetRoute { path: "/request-password-reset", to: RequestPasswordResetPage }
|
|
page RequestPasswordResetPage {
|
|
component: import { RequestPasswordReset } from "@src/client/pages/auth/RequestPasswordReset.tsx",
|
|
}
|
|
|
|
route HomeRoute { path: "/", to: MainPage }
|
|
page MainPage {
|
|
authRequired: true,
|
|
component: import Main from "@src/client/pages/Main.jsx"
|
|
}
|
|
|
|
route AboutRoute { path: "/about", to: AboutPage }
|
|
page AboutPage {
|
|
component: import About from "@src/client/pages/About.jsx"
|
|
}
|
|
|
|
route ProfileRoute { path: "/profile", to: ProfilePage }
|
|
page ProfilePage {
|
|
authRequired: true,
|
|
component: import { ProfilePage } from "@src/client/pages/ProfilePage.tsx"
|
|
}
|
|
|
|
// Page for viewing a specific task
|
|
//
|
|
route TaskRoute { path: "/task/:id", to: TaskPage }
|
|
page TaskPage {
|
|
authRequired: true,
|
|
component: import Task from "@src/client/pages/Task.tsx"
|
|
}
|
|
|
|
route CrudRoute { path: "/crud", to: Crud }
|
|
page Crud {
|
|
component: import { CrudTestPage } from "@src/client/pages/CrudTest.tsx",
|
|
authRequired: true
|
|
}
|
|
|
|
route CatchAllRoute { path: "*", to: CatchAllPage }
|
|
page CatchAllPage {
|
|
component: import { CatchAllPage } from "@src/client/pages/CatchAll"
|
|
}
|
|
|
|
// --------- Queries --------- //
|
|
|
|
query getTasks {
|
|
fn: import { getTasks } from "@src/server/queries.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
api fooBar {
|
|
fn: import { fooBar } from "@src/server/apis.js",
|
|
middlewareConfigFn: import { fooBarMiddlewareFn } from "@src/server/apis.js",
|
|
entities: [Task],
|
|
// ALL here let's our CORS work. If we did GET, we would need an apiNamespace over it with CORS.
|
|
httpRoute: (ALL, "/foo/bar")
|
|
}
|
|
|
|
apiNamespace bar {
|
|
middlewareConfigFn: import { barNamespaceMiddlewareFn } from "@src/server/apis.js",
|
|
path: "/bar"
|
|
}
|
|
|
|
api barBaz {
|
|
fn: import { barBaz } from "@src/server/apis.js",
|
|
auth: false,
|
|
entities: [Task],
|
|
httpRoute: (GET, "/bar/baz")
|
|
}
|
|
|
|
api webhookCallback {
|
|
fn: import { webhookCallback } from "@src/server/apis.js",
|
|
middlewareConfigFn: import { webhookCallbackMiddlewareFn } from "@src/server/apis.js",
|
|
httpRoute: (POST, "/webhook/callback"),
|
|
auth: false
|
|
}
|
|
|
|
query getNumTasks {
|
|
fn: import { getNumTasks } from "@src/server/queries.js",
|
|
entities: [Task],
|
|
auth: false
|
|
}
|
|
|
|
query getTask {
|
|
fn: import { getTask } from "@src/server/queries.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
query getDate {
|
|
fn: import { getDate } from "@src/server/queries.js"
|
|
}
|
|
|
|
// --------- Actions --------- //
|
|
|
|
action createTask {
|
|
fn: import { createTask } from "@src/server/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action updateTaskIsDone {
|
|
fn: import { updateTaskIsDone } from "@src/server/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action deleteCompletedTasks {
|
|
fn: import { deleteCompletedTasks } from "@src/server/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
action toggleAllTasks {
|
|
fn: import { toggleAllTasks } from "@src/server/actions.js",
|
|
entities: [Task]
|
|
}
|
|
|
|
job mySpecialJob {
|
|
executor: PgBoss,
|
|
perform: {
|
|
fn: import { foo } from "@src/server/jobs/bar.js",
|
|
executorOptions: {
|
|
pgBoss: {=json { "retryLimit": 1 } json=}
|
|
}
|
|
},
|
|
entities: [Task]
|
|
}
|
|
|
|
job mySpecialScheduledJob {
|
|
executor: PgBoss,
|
|
perform: {
|
|
fn: import { foo } from "@src/server/jobs/bar.js"
|
|
},
|
|
schedule: {
|
|
cron: "0 * * * *",
|
|
args: {=json { "foo": "bar" } json=},
|
|
executorOptions: {
|
|
pgBoss: {=json { "retryLimit": 2 } json=}
|
|
}
|
|
}
|
|
}
|
|
|
|
crud Tasks {
|
|
entity: Task,
|
|
operations: {
|
|
getAll: {
|
|
overrideFn: import { getAllFilteredTasks } from "@src/server/crud"
|
|
},
|
|
create: {}
|
|
}
|
|
}
|