ExpressApp

interface ExpressApp

An interface mapped to an Express app object, providing route configuration and other methods.

Functions

Link copied to clipboard
abstract fun delete(path: String, handler: Value)

Register a DELETE route handler at path. The handler must be a function and will receive two parameters (ExpressRequest and ExpressResponse, respectively).

Link copied to clipboard
abstract fun get(path: String, handler: Value)

Register a GET route handler at path. The handler must be a function and will receive two parameters (ExpressRequest and ExpressResponse, respectively).

Link copied to clipboard
abstract fun head(path: String, handler: Value)

Register a HEAD route handler at path. The handler must be a function and will receive two parameters (ExpressRequest and ExpressResponse, respectively).

Link copied to clipboard
open fun listen(port: Int)

Bind the server to a given port.

abstract fun listen(port: Int, callback: Value? = null)

Bind the server to a given port, optionally invoking a callback when the socket is ready.

Link copied to clipboard
abstract fun options(path: String, handler: Value)

Register an OPTIONS route handler at path. The handler must be a function and will receive two parameters (ExpressRequest and ExpressResponse, respectively).

Link copied to clipboard
abstract fun post(path: String, handler: Value)

Register a POST route handler at path. The handler must be a function and will receive two parameters (ExpressRequest and ExpressResponse, respectively).

Link copied to clipboard
abstract fun put(path: String, handler: Value)

Register a PUT route handler at path. The handler must be a function and will receive two parameters (ExpressRequest and ExpressResponse, respectively).

Link copied to clipboard
abstract fun use(handler: Value)

Register a global middleware handler. The handler must be a function and will receive an ExpressRequest, an ExpressResponse, and a callable next value, which can be used to call the next handler in the pipeline.

abstract fun use(path: String, handler: Value)

Register a middleware handler at path. The handler must be a function and will receive an ExpressRequest, an ExpressResponse, and a callable next value, which can be used to call the next handler in the pipeline.