Skip to content
GigadriveDocs

Express

What Gigadrive Network detects for an Express project, which file it runs as the Function, and the defaults it applies.

Gigadrive Network detects Express from an express entry in the dependencies or devDependencies of your root package.json. Nothing else is required: the server you already start with app.listen() is deployed as one Function that answers every path.

Defaults

SettingValue
Runtimenode-22
Memory128 MB
Max duration30 seconds
Route/* to the resolved entrypoint
EnvironmentNODE_ENV=production
Buildyour package.json build script

Express is tried second to last, ahead of only Vite, so any other framework in your dependencies wins. A project that also depends on Next.js, Nuxt, NestJS, Hono, Fastify or Elysia is detected as that framework instead.

The platform runs no build step of its own for Express. If your package.json has a build script, the build runs it with the package manager it detected; otherwise it installs dependencies and packages the project as it is. See Builds.

The entrypoint

The preset resolves the server file from your project instead of assuming one. The first candidate that exists on disk wins:

  1. main in package.json.
  2. The file argument of scripts.start, when that script is a plain node, bun run, tsx or ts-node invocation.
  3. index.js, then src/index.js, index.ts, src/index.ts, app.js, src/app.js, server.js, src/server.js, app.ts, src/app.ts, server.ts, src/server.ts.

The Node runtime executes JavaScript, so compile TypeScript first and point main at the compiled file.

That file must either call listen() while it is being imported or export the Express app or an http.Server. The server is captured during import and each request is forwarded to it, so the port you pass to listen() is ignored. Capturing a real server is also what makes WebSocket upgrades work, so an Express app with ws or socket.io needs no extra configuration.

Changing the defaults

version: 4
functions:
  server.js:
    runtime: node-22
    memory: 512
    max_duration: 60

A functions block replaces every entrypoint the preset produced, and any setting you leave out falls back to the config file's own defaults of memory: 128 and max_duration: 30 rather than the preset's. routes works the same way: one route of your own replaces the preset's /* route, so add it back if you still need it.

Express documents its own API at expressjs.com.