Skip to content

Commit

Permalink
feat(spots): get all the spots
Browse files Browse the repository at this point in the history
  • Loading branch information
brunocalderon committed Oct 21, 2019
1 parent a44c8a3 commit 2d4ca2c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions get_spots.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { parallelScan } = require('@shelf/dynamodb-parallel-scan');

async function getSpots() {
let params = {
TableName: process.env.dynamodb_table_name,
ProjectionExpression: "#id, #name, #address, #city",
ExpressionAttributeNames: {
"#id": "id",
"#name": "name",
"#address": "address",
"#city": "city"
}
};
let data = await parallelScan(params, { concurrency: 1000 });
return data;
}

exports.handler = async event => {
let query = await getSpots();
const response = {
statusCode: 200,
headers: { 'Access-Control-Allow-Origin': '*' },
body: JSON.stringify(query)
};
return response;
};

0 comments on commit 2d4ca2c

Please sign in to comment.