mirror of
https://github.com/kou029w/_.git
synced 2025-01-30 22:08:02 +00:00
25 lines
542 B
JavaScript
25 lines
542 B
JavaScript
import fastify from "fastify";
|
|
|
|
const server = fastify({ logger: true });
|
|
|
|
server.get("/", {
|
|
schema: {
|
|
querystring: {
|
|
type: "object",
|
|
properties: { dateTime: { type: "string", format: "date-time" } },
|
|
required: ["dateTime"],
|
|
},
|
|
},
|
|
handler() {
|
|
return "ok";
|
|
},
|
|
});
|
|
|
|
// valid
|
|
await server.inject("/?dateTime=2021-09-10T15:30:00Z");
|
|
|
|
// valid
|
|
await server.inject("/?dateTime=2021-09-10T15:30:00");
|
|
|
|
// invalid: querystring/dateTime must match format "date-time"
|
|
await server.inject("/?dateTime=2021-09-10");
|