Contentstack Launch Test

A minimal Next.js app for testing Contentstack Launch features

Routes Reference

A running list of every route in this project, kept here so it survives each redeploy.

API Routes

GET/api/log-bulk

Writes `count` stdout log lines (Node runtime), each padded to `sizeKb`.

e.g. /api/log-bulk?count=5&sizeKb=1&startIndex=1

GET/api/log-bulk-requests

Fires `count` sequential HTTP calls to /api/log-bulk so each log is its own request.

e.g. /api/log-bulk-requests?count=5&sizeKb=1

GET/api/log-chunk

Emits chunked console.log lines capped at `lineKb`, tunes JSON response to `responseKb`.

e.g. /api/log-chunk?lineKb=1&responseKb=10

GET/api/log-size

Prints one console.log line of roughly `size` KB.

e.g. /api/log-size?size=1024

GET, POST/api/reproduce-large-log

Forwards a synthetic OTLP log record directly to the telemetry endpoint (bypasses stdout).

e.g. /api/reproduce-large-log?size=1100000

GET, POST/api/reproduce-telemetry-kafka

Writes one raw stdout line of `size` repeated characters (no OTLP wrapper).

e.g. /api/reproduce-telemetry-kafka?size=1100000

Page Routes

PAGE/

Home / landing page (this page).

PAGE/rewrite

Rewrite source page demo.

PAGE/rewrite/success

Rewrite destination page demo.

PAGE/new_rewrite

Another rewrite demo page.

PAGE/log-bulk-requests

UI wrapper that fires per-log requests to /api/log-bulk.

PAGE/cache-priming1

Static cache-priming target #1 (listed in launch.json cachePriming.urls).

PAGE/cache-priming2

Static cache-priming target #2 (listed in launch.json cachePriming.urls).

PAGE/cache-priming3

Static cache-priming target #3 (listed in launch.json cachePriming.urls).

PAGE/cache-priming4

Static cache-priming target #4 (listed in launch.json cachePriming.urls).

PAGE/cache-priming5

Static cache-priming target #5 (listed in launch.json cachePriming.urls).

Cloud Functions (functions/)

FUNCTION/cache_priming_cloud

Cache-priming target that returns JSON with an explicit s-maxage; `generatedAt` stays put on a cache hit.

FUNCTION/hello

Echoes back the request body, query and cookies.

FUNCTION/user

Returns a name plus its short form via functions/utils.js.

Edge Functions

EDGE/edge

Returns the current server timestamp.

EDGE/edge/geo

Returns geo headers (country/region/city) forwarded by the platform.

Redirects & Rewrites (launch.json)

308/redirect

Redirects to /redirect/success.

REDIRECT/new_redirect

Redirects to external URL launchassignment-b6f4d9.contentstackapps.com.

REWRITE/rewrite

Rewrites to /rewrite/success.

REWRITE/rewrite1

Rewrites to /new_rewrite.

Cache Priming

The paths below are listed under cache.cachePriming.urls in launch.json. Launch requests each one right after a deploy, so the edge is warm before real traffic arrives.

The pages are statically prerendered, so the first real visitor gets a cache hit instead of a cold render. The cloud function has to opt in itself: it sends s-maxage so the edge is allowed to store the response, since an uncacheable function would just re-run on every request and gain nothing from priming.

Check a primed response with curl -sI https://<your-domain>/cache-priming1 and look at the cache/age headers.