Docs
Guide
Build Server

Build Server

You can compile the server into executable JavaScript using the build feature.

WARNING

🚧 This feature is still under development.

#Building a Runnable Server

Since Dobs uses file-based routing and automatic route loading, it cannot run without the Dobs CLI or API. Additionally, when using TypeScript files, loading pages may take extra time.

By using the build feature, you can compile your project into a standalone executable form that preloads all TypeScript files, allowing it to run independently of the framework.

The compiled code uses the same internal logic as the Dobs dev server, ensuring full compatibility.

#Build with CLI

Terminal
dobs build

Use the build command to compile your project.

A _temp.js file will be generated inside the /dist/ directory.

#Build with API

Typescript
import { buildServer, resolveConfig } from "dobs";
 
const config = {};
 
buildServer(resolveConfig(config)).then(() => {});

You can build the server using the buildServer() function. Since it requires a resolved configuration, make sure to provide it with resolveConfig().