Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task 5 s3 integration #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.serverless
*.yml
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"trailingComma": "es5",
"semi": true,
"singleQuote": true
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# shop-nodejs-aws-serverless

Backend for E-Commerce application (Shop) created with NodeJS, AWS Cloud and Serverless architecture and Serverless framework
8 changes: 2 additions & 6 deletions import-service/configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,5 @@ const dotenv = require('dotenv');

module.exports = async () => {
const envVars = dotenv.config({ path: '.env.local' }).parsed;
return Object.assign(
{},
envVars,
process.env,
);
};
return Object.assign({}, envVars, process.env);
};
12 changes: 6 additions & 6 deletions import-service/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import AWS from 'aws-sdk';
import * as handlers from './src';
import { winstonLogger as logger } from './src/utils/winstonLogger';

const s3 = new AWS.S3({ region: 'us-east-1' });
const s3 = new AWS.S3({ region: process.env.REGION });

export const getProductById = handlers.importFileParser({
s3,
logger,
export const importFileParser = handlers.importFileParser({
s3,
logger,
});

export const getAllProducts = handlers.importProductsFile({
s3,
export const importProductsFile = handlers.importProductsFile({
s3,
});
Loading