albert6232
albert6232
WWasp-lang
Created by albert6232 on 6/10/2024 in #đŸ™‹questions
crud get
Can seem to figure out how to curl a /Tasks/get to my database. See the following setup: main.wasp
route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}

route HelloRoute { path: "/hello/:name", to: HelloPage }
page HelloPage {
component: import { HelloPage } from "@src/HelloPage"
}

route TestRoute { path: "/test", to: TestPage }
page TestPage {
component: import { TestPage } from "@src/TestPage"
}

entity Task {=psl
id Int @id @default(autoincrement())
description String
isDone Boolean @default(false)
psl=}


crud Tasks {
entity: Task,
operations: {
getAll: {
isPublic: true
},
get: {
isPublic: true
}
}
}
route RootRoute { path: "/", to: MainPage }
page MainPage {
component: import { MainPage } from "@src/MainPage"
}

route HelloRoute { path: "/hello/:name", to: HelloPage }
page HelloPage {
component: import { HelloPage } from "@src/HelloPage"
}

route TestRoute { path: "/test", to: TestPage }
page TestPage {
component: import { TestPage } from "@src/TestPage"
}

entity Task {=psl
id Int @id @default(autoincrement())
description String
isDone Boolean @default(false)
psl=}


crud Tasks {
entity: Task,
operations: {
getAll: {
isPublic: true
},
get: {
isPublic: true
}
}
}
This curl command works on /Tasks/get-all...
curl -X POST http://192.168.0.8:3001/Tasks/get-all
curl -X POST http://192.168.0.8:3001/Tasks/get-all
response is:
{
"json": [
{
"id": 1,
"description": "This is a test",
"isDone": true
},
{
"id": 2,
"description": "This is another test",
"isDone": false
},
{
"id": 3,
"description": "This is one more",
"isDone": false
}
]
}
{
"json": [
{
"id": 1,
"description": "This is a test",
"isDone": true
},
{
"id": 2,
"description": "This is another test",
"isDone": false
},
{
"id": 3,
"description": "This is one more",
"isDone": false
}
]
}
How would I format a curl POST command to /Tasks/get id 1??
17 replies