Simple example demonstrating how to accomplish a direct upload to Amazon's S3 in a Node.js web application.
This example uses the express web framework to facilitate request-handling. However, the process of signing the S3 PUT request would be identical in most Node apps.
This code is mostly ready to be run as cloned, but a function update_account()
will need to be defined to handle the storing of the POSTed information. The current example simply demonstrates the upload to S3.
Ensure Node is installed. This can be done through your package manager or from their website.
Clone this repository and install the dependencies with npm:
$ git clone [email protected]:f3r/NodeDirectUploader.git
$ cd NodeDirectUploader
$ npm install
- Set environment variables for your AWS access key and secret (see Heroku's Config Vars article)
- Download and install the Heroku toolbelt
- Run with Foreman
$ foreman start
See the article Deploying with Git for more detailed information on deploying to Heroku.
- Download and install the Heroku toolbelt
- Create the application on Heroku by adding a Git remote (
$ heroku create
) - Push your code to the new Heroku repo (
$ git push heroku master
)