Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `saveBandwidthOverCache` parameter for skipping caching for products data - @andrzejewsky (#3706)
- New zoom effect for product gallery images - @Michal-Dziedzinski (#2755)
- Product Page Schema implementation as JSON-LD - @Michal-Dziedzinski (#3704)
- Add `/cache-version.json` route to get current cache version

### Fixed
- Fixed Search product fails for category filter when categoryId is string - @adityasharma7 (#3929)
Expand Down
7 changes: 7 additions & 0 deletions core/scripts/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { serverHooksExecutors } from '@vue-storefront/core/server/hooks'
let config = require('config')
const path = require('path')
const glob = require('glob')
const fs = require('fs')
const rootPath = require('app-root-path').path
const resolve = file => path.resolve(rootPath, file)
const serverExtensions = glob.sync('src/modules/*/server.{ts,js}')
Expand Down Expand Up @@ -146,6 +147,12 @@ app.use('/service-worker.js', serve('dist/service-worker.js', false, {
app.post('/invalidate', invalidateCache)
app.get('/invalidate', invalidateCache)

function cacheVersion (req, res) {
res.send(fs.readFileSync(resolve('core/build/cache-version.json')))
}

app.get('/cache-version.json', cacheVersion)

app.get('*', (req, res, next) => {
if (NOT_ALLOWED_SSR_EXTENSIONS_REGEX.test(req.url)) {
apiStatus(res, 'Vue Storefront: Resource is not found', 404)
Expand Down