Releases: aws-samples/eb-node-express
Add Interface Support for Adding New Hikes
Add a form to allow adding new hike entries at the /hikes route.
Use the New Features
Visit /hikes at your application's URL to use the new feature. Add some entries to the database.
▼ The ZIP file attached to this release can be deployed directly to AWS Elastic Beanstalk.
Add MySQL Support for Hiking Feature
Add MySQL support to the /hikes route by adding an RDS database to the Elastic Beanstalk environment. Database connection information is accessible via the environment and retrieved via process.env in app.js
:
Use the New Features
There's not much to see here as we've just added the code to use a MySQL database. Check out the next release to actually use the new feature!
About the New Features
app.configure('production', function() {
console.log('Using production settings.');
app.set('connection', mysql.createConnection({
host: process.env.RDS_HOSTNAME,
user: process.env.RDS_USERNAME,
password: process.env.RDS_PASSWORD,
port: process.env.RDS_PORT}));
});
We also introduce an environment variable via .ebextensions/static.config
to inform the app if it's running in prod or dev:
option_settings:
...
- option_name: NODE_ENV
value: production
Requirements
Your Elastic Beanstalk environment must be configured with a MySQL RDS database.
▼ The ZIP file attached to this release can be deployed directly to AWS Elastic Beanstalk.
Add Custom Hiking Feature
Add a /hikes route, corresponding view, and static asset support to serve CSS files. Static assets are configured via a config file in the .ebextensions directory.
Use the New Features
Visit /hikes at your application's URL to see the new feature.
About the New Features
Elastic Beanstalk configuration files (discussed in the documentation allow an Elastic Beanstalk to be customized via code. In this release, we create a .ebextensions/static.config
in our application and specify a setting that will allow our app to serve static assets:
option_settings:
- namespace: aws:elasticbeanstalk:container:nodejs:staticfiles
option_name: /public
value: /public
▼ The ZIP file attached to this release can be deployed directly to AWS Elastic Beanstalk.
Node.js and Express Minimal App
Minimal Node.js and Express app on Elastic Beanstalk from the Elastic Beanstalk Developer Guide.
▼ The ZIP file attached to this release can be deployed directly to AWS Elastic Beanstalk.