Kenny
Kenny
WWasp-lang
Created by Kenny on 10/9/2024 in #đŸ™‹questions
How do I create a page to display a single Task?
Taking the example 'todo' app as an example. How do I create a page to show a single Task? I've given it a go but I've hit a dead end! Using the example from https://wasp-lang.dev/docs/tutorial/pages I have the following but have no idea how to use RouteComponentProps. In main.wasp I have:
route TaskRoute { path: "/tasks/:taskId", to: TaskPage }
page TaskPage {
authRequired: true,
component: import TaskPage from "@src/tasks/TaskPage",
}
route TaskRoute { path: "/tasks/:taskId", to: TaskPage }
page TaskPage {
authRequired: true,
component: import TaskPage from "@src/tasks/TaskPage",
}
in operations.ts I have:
import { RouteComponentProps } from 'react-router-dom';

import { Task } from 'wasp/entities';
import { type GetTask } from 'wasp/server/operations';

export const getTask: GetTask<void, Task[]> = async (args, context) => {
const task = await context.entities.Task.findUnique({
where: { id: taskId },
});
};
import { RouteComponentProps } from 'react-router-dom';

import { Task } from 'wasp/entities';
import { type GetTask } from 'wasp/server/operations';

export const getTask: GetTask<void, Task[]> = async (args, context) => {
const task = await context.entities.Task.findUnique({
where: { id: taskId },
});
};
9 replies
WWasp-lang
Created by Kenny on 10/1/2024 in #đŸ™‹questions
Where to place CSV file when seeding the database
I'm trying to seed the database with a CSV file but I'm struggling to figure out where to place the CSV file when running fs.createReadStream(path.join(process.cwd(), 'data.csv')). I'm using path.join(process.cwd(), 'data.csv') but the CSV file doesn't exist in .wasp/out/server/bundle/. Any help is appreciated!
9 replies