Note: This sample uses the older vm: true
configuration. It will be upgraded
to use the newer env: flex
configuration when env: flex
fully supports
Memcached.
This is a simple guide to using memcached for session state while running Express.js on Google App Engine. This sample uses the connect-memjs module to store session data in memcached.
If you haven't already, copy the repository to your local machine by entering the following command in your terminal window:
git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git
cd nodejs-docs-samples/appengine/express-memcached-session
Alternatively, you can download the sample as a zip and extract it.
-
Install dependencies:
npm install
-
Run the start script:
npm start
-
In your web browser, visit the following address:
You can see the sample app displayed in the page. In your terminal window, press Ctrl+C to exit the web server.
In your terminal window, enter the following command to deploy the sample:
gcloud app deploy
In your web browser, enter the following address:
https://<your-project-id>.appspot.com
Every Google App Engine Flexible Environment application requires an app.yaml
file to describe its deployment configuration:
runtime: nodejs
env: flex