Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Using DynamoDB with Node.js, Express.js
var aws_router = require('./routes/aws');
app.use('/aws', aws_router);
//npm install aws-sdk
//visit http://localhost:3000/aws/table-list
var express = require('express');
var router = express.Router();
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./config.json');
AWS.config.apiVersions = {
//dynamodb: '2011-12-05',
//ec2: '2013-02-01',
dynamodb: 'latest'
}
var db = new AWS.DynamoDB();
router.get('/table-list', function(req, res, next) {
db.listTables(function(err, data) {
console.log(data.TableNames);
});
res.send('AWS - See the console plz.');
});
module.exports = router;
{ "accessKeyId": "xxx", "secretAccessKey": "xxx", "region": "us-east-1" }
@fortheworld2017

This comment has been minimized.

Copy link

@fortheworld2017 fortheworld2017 commented Jul 21, 2017

Great help :)

@moonseoklee

This comment has been minimized.

Copy link

@moonseoklee moonseoklee commented May 29, 2020

Good :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment