GardenCloud & systems

An older Express-on-Netlify build layout

Two netlify-lambda directory arrangements and the difference between function output and a site's publish directory.

The earlier Express/Netlify example separated the function build output from the site’s publish directory. It showed two arrangements using netlify-lambda 1.6.3 and serverless-http 2.3.0 ranges.

Functions at the root

[build]  command = "npm install && npm run build"  functions = "functions"
{  "name": "expressjs_netlify",  "version": "1.0.0",  "description": "",  "main": "index.js",  "scripts": {    "build": "netlify-lambda build express",    "start": "netlify-lambda serve express"  },  "devDependencies": {    "body-parser": "^1.19.0",    "cookie-parser": "^1.4.5",    "netlify-lambda": "^1.6.3",    "serverless-http": "^2.3.0"  },  "keywords": [],  "author": "",  "license": "ISC",  "dependencies": {}}

The original dashboard left the publish directory unset for this function-focused layout. The flattened TOML text needs normal line boundaries before it can be reused.

Functions under dist

[build]  command = "npm install && npm run build"  functions = "dist/functions"
{  "name": "expressjs_netlify",  "version": "1.0.0",  "description": "",  "main": "index.js",  "scripts": {    "build": "rm -rf dist && mkdir -p dist && netlify-lambda build express",    "start": "netlify-lambda serve express"  },  "devDependencies": {    "body-parser": "^1.19.0",    "cookie-parser": "^1.4.5",    "netlify-lambda": "^1.6.3",    "serverless-http": "^2.3.0"  },  "keywords": [],  "author": "",  "license": "ISC",  "dependencies": {}}

This layout set the publish directory to dist and placed function artifacts below it. Its build command first deletes dist, which is a real filesystem mutation.

The source’s response-streaming limitation described its earlier platform/runtime and is not asserted as current behavior. Source: original example repository. No build or deployment of that application was performed for this revision.

← Back to the garden