Skip to content

Guide on how-to enable caching on Hydrogren deployed to production Node.js environment #937

Answered by jplhomer
iliapir2 asked this question in Help
Discussion options

You must be logged in to vote

In order to apply a cache, you'll want to follow the instructions for "Use a different Node framework" instead: https://shopify.dev/custom-storefronts/hydrogen/deployment#use-a-different-node-js-framework

Here's what I have in my project:

import {hydrogenMiddleware} from '@shopify/hydrogen/middleware';
import serveStatic from 'serve-static';
import compression from 'compression';
import bodyParser from 'body-parser';
import connect from 'connect';
import path from 'path';
const {
  InMemoryCache,
} = require('@shopify/hydrogen/dist/node/framework/cache/in-memory');

const inMemoryCache = new InMemoryCache();

const port = process.env.PORT || 8080;

function createServer() {
  const app = c…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@iliapir2
Comment options

Answer selected by iliapir2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants