Docs
Concepts
Route

Route

A route is a triplet of (1) HTTP method, (2) pathname, and (3) a handler or an execution pipeline.

Websi provides convenient aliases for every HTTP method to describe those triplets as functions e.g. GET, POST. They are available via websi/route subpath.

import { GET, POST } from 'websi/route'
 
// regular handler
GET('/welcome', () => Response.OK('Hello, Websi'))
 
// execution pipeline
POST('/welcome', [ 
  CORS(), 
  () => Response.OK('Hello, Websi') 
])