dynamodb-admin
Advanced tools
Comparing version
38
index.js
@@ -11,2 +11,7 @@ const express = require('express') | ||
if (process.env.NODE_ENV === 'production') { | ||
console.error('\x1b[31mDo not run this in production!') // red | ||
process.exit(1) | ||
} | ||
const app = express() | ||
@@ -54,2 +59,35 @@ app.set('json spaces', 2) | ||
app.get('/create-table', (req, res) => { | ||
res.render('create-table', {}) | ||
}) | ||
app.post('/create-table', bodyParser.urlencoded({extended: false}), (req, res, next) => { | ||
dynamodb.createTable({ | ||
TableName: req.body.TableName, | ||
ProvisionedThroughput: { | ||
ReadCapacityUnits: req.body.ReadCapacityUnits, | ||
WriteCapacityUnits: req.body.WriteCapacityUnits | ||
}, | ||
KeySchema: [{ | ||
AttributeName: 'id', | ||
KeyType: 'HASH' | ||
}], | ||
AttributeDefinitions: [{ | ||
AttributeName: 'id', | ||
AttributeType: 'S' | ||
}] | ||
}).promise().then((response) => { | ||
res.redirect('/') | ||
}).catch(next) | ||
}) | ||
app.delete('/tables/:TableName', (req, res, next) => { | ||
const TableName = req.params.TableName | ||
dynamodb.deleteTable({TableName}).promise() | ||
.then(() => { | ||
res.status(204).end() | ||
}) | ||
.catch(next) | ||
}) | ||
app.get('/tables/:TableName', (req, res, next) => { | ||
@@ -56,0 +94,0 @@ const TableName = req.params.TableName |
{ | ||
"name": "dynamodb-admin", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "GUI for DynamoDB. Useful for local development.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
119653
3.09%19
11.76%742
4.8%9
12.5%