this.namespace = "api"
this.logging = false
this.get("/vans", (schema, request) => {
return schema.vans.all()
})
this.get("/vans/:id", (schema, request) => {
const id = request.params.id
return schema.vans.find(id)
})
this.get("/host/vans", (schema, request) => {
// Hard-code the hostId for now
return schema.vans.where({ hostId: "123" })
})
this.get("/host/vans/:id", (schema, request) => {
// Hard-code the hostId for now
const id = request.params.id
return schema.vans.where({ id, hostId: "123" })
})
}
})
hostId: "456" })
server.create("van", { id: "4", name: "Dreamfinder", price: 65, description: "Dreamfinder
is the perfect van to travel in and experience. With a ceiling height of 2.1m, you can
stand up in this van and there is great head room. The floor is a beautiful
glass-reinforced plastic (GRP) which is easy to clean and very hard wearing. A large rear
window and large side windows make it really light inside and keep it well ventilated.",
imageUrl: "https://assets.scrimba.com/advanced-react/react-router/dreamfinder.png", type:
"simple", hostId: "789" })
server.create("van", { id: "5", name: "The Cruiser", price: 120, description: "The Cruiser
is a van for those who love to travel in comfort and luxury. With its many windows,
spacious interior and ample storage space, the Cruiser offers a beautiful view wherever you
go.", imageUrl: "https://assets.scrimba.com/advanced-react/react-router/the-cruiser.png",
type: "luxury", hostId: "789" })
server.create("van", { id: "6", name: "Green Wonder", price: 70, description: "With this
van, you can take your travel life to the next level. The Green Wonder is a sustainable
vehicle that's perfect for people who are looking for a stylish, eco-friendly mode of
transport that can go anywhere.", imageUrl:
"https://assets.scrimba.com/advanced-react/react-router/green-wonder.png", type: "rugged",
hostId: "123" })
},
routes() {