Starting on working bookmarks api
This commit is contained in:
12
web/lib/apiHelpers.js
Normal file
12
web/lib/apiHelpers.js
Normal file
@@ -0,0 +1,12 @@
|
||||
function withErrorHandling(handler) {
|
||||
return async (req, res) => {
|
||||
try {
|
||||
await handler(req, res);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
res.status(error.status || 500).end(error.message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export { withErrorHandling };
|
||||
13
web/lib/db.js
Normal file
13
web/lib/db.js
Normal file
@@ -0,0 +1,13 @@
|
||||
const AWS = require("aws-sdk");
|
||||
|
||||
AWS.config.update({
|
||||
accessKeyId: process.env.FMN_AWS_ACCESS_KEY_ID, // Do NOT HARD-CODE your secret credentials here
|
||||
secretAccessKey: process.env.FMN_AWS_SECRET_ACCESS_KEY, // Do NOT HARD-CODE your secret credentials here
|
||||
region: process.env.FMN_AWS_REGION,
|
||||
});
|
||||
|
||||
const dynamodb = new AWS.DynamoDB.DocumentClient({
|
||||
region: process.env.FMN_AWS_REGION,
|
||||
});
|
||||
|
||||
export default dynamodb;
|
||||
Reference in New Issue
Block a user