Usage Chart
How strongly this package shapes the runtime
Package Flow
How this package moves through xtaskjs runtime phases
Before startup
Create an Express app, register its middleware stack, and optionally configure template engines or static asset behavior.
During CreateApplication()
The Express adapter maps xtaskjs routes into Express handlers and preserves view(), JSON, and status-code responses.
During app.close()
The xtask application stops the active server while your existing Express middleware and configuration remain the same application-wide boundary.
API Surface
Representative exports from the upstream package
Adapter runtime
- ExpressAdapter
- view
- HttpAdapter
- HttpRequestHandler
Request and response types
- HttpRequestLike
- HttpResponseLike
- HttpServerOptions
- HttpViewResult
- HttpAdapterType
Adapter options
- ExpressAdapterOptions
- ExpressTemplateEngineOptions
- ExpressStaticFilesOptions
Usage
Typical adoption flow
1. Create the Express app
Enable JSON parsing, cookies, sessions, or any other Express middleware before handing control to xtaskjs.
2. Pass the adapter
Wrap the instance with new ExpressAdapter(expressApp) and pass it into CreateApplication().
3. Return framework-native results
Keep controllers portable by returning plain objects or view() results while the adapter handles Express-specific rendering details.
Example
Reference snippet
import express from "express";
import { CreateApplication } from "@xtaskjs/core";
import { ExpressAdapter } from "@xtaskjs/express-http";
const expressApp = express();
expressApp.use(express.json());
await CreateApplication({
adapter: new ExpressAdapter(expressApp),
autoListen: true,
server: { host: "127.0.0.1", port: 3000 },
});
Samples
Official samples to inspect next
Reference samples: 02-express_app and 07-security_express_app
Related
Packages commonly used with this one