wasp/examples/tutorials/TodoApp/main.wasp
2024-07-03 13:51:29 +02:00

56 lines
1.6 KiB
JavaScript

app TodoApp {
wasp: {
version: "^0.14.0" // Pins the version of Wasp to use.
},
title: "TodoApp", // Used as the browser tab title. Note that all strings in Wasp are double quoted!
auth: {
// Tells Wasp which entity to use for storing users.
userEntity: User,
methods: {
// Enable username and password auth.
usernameAndPassword: {}
},
// We'll see how this is used in a bit.
onAuthFailedRedirectTo: "/login"
}
}
route RootRoute { path: "/", to: MainPage }
page MainPage {
authRequired: true,
// We specify that the React implementation of the page is exported from
// `src/MainPage.tsx`. This statement uses standard JS import syntax.
// Use `@src` to reference files inside the `src` folder.
component: import { MainPage } from "@src/MainPage"
}
route SignupRoute { path: "/signup", to: SignupPage }
page SignupPage {
component: import { SignupPage } from "@src/SignupPage"
}
route LoginRoute { path: "/login", to: LoginPage }
page LoginPage {
component: import { LoginPage } from "@src/LoginPage"
}
query getTasks {
// Specifies where the implementation for the query function is.
// The path `@src/queries` resolves to `src/queries.js`.
// No need to specify an extension.
fn: import { getTasks } from "@src/queries",
// Tell Wasp that this query reads from the `Task` entity. Wasp will
// automatically update the results of this query when tasks are modified.
entities: [Task]
}
action createTask {
fn: import { createTask } from "@src/actions",
entities: [Task]
}
action updateTask {
fn: import { updateTask } from "@src/actions",
entities: [Task]
}