This app is a solution for SPA problems with SEO.
Running on local environment the API require instance of Redis. Before start development locally, please make sure you have installed Chrome browser and instance of Redis was run. (MAC | Windows)
install dependencies
npm install
Run prerender API
npm run start
Run for local development with watching file changes by nodemon
npm run start:dev
Development using Docker
Please, take in mind, that the Dockerfile isn't for local usage. It exists to simplify inserting the app into complex infrastructures.
For development, please use docker-compose.yml only.
Run instance for local development with watching file changes by nodemon
docker compose up
Deployment using Dockerfile require only REDIS_URL.
REDIS_URL= connection to Redis within your environment
RABBITMQ_URL= connection to RabbitMQ within your environment (optional)
Defaults
PORT=3636DEBUG=falseHOST=0.0.0.0ALLOW_DOMAINS=.CHROME_DEBUGGING_PORT=9222CHROME_BIN=/usr/bin/chromium-browserCHROME_FLAGS=--no-sandbox,--headless,--disable-gpu,--remote-debugging-port=9222,--hide-scrollbars,--disable-dev-shm-usageREDIS_URL=RABBITMQ_URL=RABBITMQ_CHANNELS=1RABBITMQ_QUEUE=PRERENDER
-
To know Service health
- GET /health
curl 'http://localhost:3636/health'{ status: "UP" | "DOWN" }
-
Will render URL in
Chromiumbrowser then returnHTMLonly the first time. After that, provideHTMLcontent from the cache.- GET /render
curl 'http://localhost:3636/render?url=http://example.com/'
-
Force reset the cache and render URL in
Chromiumbrowser, returnsHTML.- GET /refresh
curl 'http://localhost:3636/refresh?url=http://example.com/'- Optional query
ignoreResults=trueto avoid html results
-
Force reset the cache and render URLs in
Chromiumbrowser- POST /refresh
curl 'http://localhost:3636/refresh' -X 'POST' --data-raw '["not a link","http://example.com/","http://example.com/"]'
-
Will get URL
HTMLcontent from the cache.- GET /cached
curl 'http://localhost:3636/cached?url=http://example.com/'
-
Will clear URL
HTMLcontent from the cache.- DELETE /cached
curl -X 'DELETE' 'http://localhost:3636/cached?url=http://example.com/'
- Render SPA page to get HTML
- Cache HTML
- Refresh cached HTML
- Cache unlimited but controlled via API
- Health status
- Base environment
- Docker image
- Docker for local development
- Domain limitation
- Queue for rendering
- Accumulate Sitemap
- Different cache technology
- Different queue technology