CAKE20

AI Web PaaS

Route

Leave HTTP, WebSocket and SSE routes without prefix.

Direct Route

  • server/routes/hello.ts → GET /hello
  • A string return value becomes a text/html response, and an object return value becomes a JSON response.
  • server/routes/status.get.ts → GET /status
  • server/routes/user.post.ts → POST /user
  • server/api files use the /api prefix, and HTTP files in server/routes use the /api prefix. Use the file path directly as the URL.
  • Even if the URL is the same, if the HTTP method is different, such as GET of the page and POST of the route, Each can be used.
// server/routes/hello.ts
export default () => {
  return "hello world";
};