getServeOptions
Reference
getServeOptions(): Promise<ServeOptions>
The getServeOptions
function is used to get the serve options of Brisa to make a custom server.
Returns:
- A
Promise
that resolves to the BrisaServeOptions
.
Example usage:
import { getServeOptions, serve } from "brisa/server";
const serveOptions = await getServeOptions();
const { server, port, hostname } = serve({
...serveOptions,
fetch(req, server) {
// Your implementation here ...
// Brisa handler
return serveOptions.fetch(req, server);
},
port: 3001,
});
console.log(
"Server ready ๐ฅณ",
`listening on http://${hostname}:${port}...`,
);
Types
ServeOptions
type are all the options to use with Bun.serve
.