import dynamoDB from "./libs/dynamoDB";
import { success, failure } from "./libs/response";
export async function main() {
const params = {
TableName: process.env.tableName
};
try {
const result = await dynamoDB.scan(params).promise();
// Return the matching list of items in response body
return success(result.Items);
} catch (e) {
return failure({ status: false });
}
}
import AWS from "aws-sdk";
export default new AWS.DynamoDB();
import AWS from "aws-sdk";
export default new AWS.DynamoDB();
import DynamoDB from "aws-sdk/clients/dynamodb";
export default new DynamoDB();
import DynamoDB from "aws-sdk/clients/dynamodb";
export default new DynamoDB();
import { DynamoDB } from "@aws-sdk/client-dynamodb-node";
export default new DynamoDB({});
import dynamoDB from "./libs/dynamoDB";
import { success, failure } from "./libs/response";
export async function main() {
const params = {
TableName: process.env.tableName
};
try {
const result = await dynamoDB.scan(params).promise();
// Return the matching list of items in response body
return success(result.Items);
} catch (e) {
return failure({ status: false });
}
}
import dynamoDB from "./libs/dynamoDB";
import { success, failure } from "./libs/response";
export async function main() {
const params = {
TableName: process.env.tableName
};
try {
const result = await dynamoDB.scan(params);
// Return the matching list of items in response body
return success(result.Items);
} catch (e) {
return failure({ status: false });
}
}
import { DynamoDB } from "@aws-sdk/client-dynamodb-node";
export default new DynamoDB({});
import { DynamoDBClient } from "@aws-sdk/client-dynamodb-node";
export default new DynamoDBClient({});
import dynamoDB from "./libs/dynamoDB";
import { success, failure } from "./libs/response";
export async function main() {
const params = {
TableName: process.env.tableName
};
try {
const result = await dynamoDB.scan(params);
// Return the matching list of items in response body
return success(result.Items);
} catch (e) {
return failure({ status: false });
}
}
import dynamoDB from "./libs/dynamoDB";
import { success, failure } from "./libs/response";
import { ScanCommand } from "@aws-sdk/client-dynamodb-node";
export async function main() {
const params = {
TableName: process.env.tableName
};
try {
const result = await dynamoDBClient.send(new ScanCommand(params));
// Return the matching list of items in response body
return success(result.Items);
} catch (e) {
return failure({ status: false });
}
}
import { s3Client } from "./s3Client";
import { config } from "../config";
const deleteObject = async (fileName: string) =>
s3Client
.deleteObject({
Key: fileName,
Bucket: config.s3Bucket
})
.promise();
export { deleteObject };
import AWS from "aws-sdk";
import { config } from "../config";
const s3Client = new AWS.S3({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
});
export { s3Client };
import AWS from "aws-sdk";
import { config } from "../config";
const s3Client = new AWS.S3({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
});
export { s3Client };
import AWS from "aws-sdk/global";
import s3 from "aws-sdk/clients/s3";
import { config } from "../config";
const s3Client = new s3({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
});
export { s3Client };
import AWS from "aws-sdk/global";
import s3 from "aws-sdk/clients/s3";
import { config } from "../config";
const s3Client = new s3({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
});
export { s3Client };
import { S3 } from "@aws-sdk/client-s3-browser";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity-browser";
import { config } from "../config";
const s3Client = new S3({
region: "us-west-2",
credentials: fromCognitoIdentityPool({
client: cognitoIdentityClient,
identityPoolId: config.IdentityPoolId
})
});
const cognitoIdentityClient = new CognitoIdentityClient({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
credentials: () => Promise.resolve({} as any),
signer: {} as any //this is required
});
cognitoIdentityClient.middlewareStack.remove("SIGNATURE");
import { s3Client } from "./s3Client";
import { config } from "../config";
const deleteObject = async (fileName: string) =>
s3Client
.deleteObject({
Key: fileName,
Bucket: config.s3Bucket
})
.promise();
export { deleteObject };
import { s3Client } from "./s3Client";
import { config } from "../config";
const deleteObject = async (fileName: string) =>
s3Client
.deleteObject({
Key: fileName,
Bucket: config.s3Bucket
});
export { deleteObject };
import { S3 } from "@aws-sdk/client-s3-browser";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity-browser/CognitoIdentityClient";
import { config } from "../config";
const s3Client = new S3({
region: "us-west-2",
credentials: fromCognitoIdentityPool({
client: cognitoIdentityClient,
identityPoolId: config.IdentityPoolId
})
});
const cognitoIdentityClient = new CognitoIdentityClient({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
credentials: () => Promise.resolve({} as any),
signer: {} as any //this is required
});
cognitoIdentityClient.middlewareStack.remove("SIGNATURE");
import { S3Client } from "@aws-sdk/client-s3-browser";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity-browser";
import { config } from "../config";
const s3Client = new S3Client({
region: "us-west-2",
credentials: fromCognitoIdentityPool({
client: cognitoIdentityClient,
identityPoolId: config.IdentityPoolId
})
});
const cognitoIdentityClient = new CognitoIdentityClient({
region: "us-west-2",
credentials: new AWS.CognitoIdentityCredentials(
{
IdentityPoolId: config.IdentityPoolId
},
{
region: "us-west-2"
}
)
credentials: () => Promise.resolve({} as any),
signer: {} as any //this is required
});
cognitoIdentityClient.middlewareStack.remove("SIGNATURE");
import { s3Client } from "./s3Client";
import { config } from "../config";
const deleteObject = async (fileName: string) =>
s3Client
.deleteObject({
Key: fileName,
Bucket: config.s3Bucket
});
export { deleteObject };
import { DeleteObjectCommand } from "@aws-sdk/client-s3-browser";
import { s3Client } from "./s3Client";
import { config } from "../config";
const deleteObject = async (fileName: string) =>
s3Client.send(
new DeleteObjectCommand({
Key: fileName,
Bucket: config.s3Bucket
})
);
export { deleteObject };
import React from "react";
import { Router } from "@reach/router";
import {
ListNotes,
CreateNote,
ShowNote,
NotFound
} from "./content";
const Routes = () => (
<Router>
<ListNotes path="/" />
<CreateNote path="/note/new" />
<ShowNote path="/notes/:noteId" />
<NotFound default />
</Router>
);
export { Routes };
import React, { lazy, Suspense } from "react";
import { Router } from "@reach/router";
const ListNotes = lazy(() => import("./content/ListNotes"));
const CreateNote = lazy(() => import("./content/CreateNote"));
const ShowNote = lazy(() => import("./content/ShowNote"));
const NotFound = lazy(() => import("./content/NotFound"));
const Routes = () => (
<Suspense fallback={<div>Loading...</div>}>
<Router>
<ListNotes path="/" />
<CreateNote path="/note/new" />
<ShowNote path="/notes/:noteId" />
<NotFound default />
</Router>
</Suspense>
);
export { Routes };
export { CreateNote };
export default CreateNote;