This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { graphql, buildSchema } = require('graphql'); | |
const { makeExecutableSchema } = require('graphql-tools'); | |
const AWS = require('aws-sdk'); | |
// Set up AWS DynamoDB | |
const dynamodb = new AWS.DynamoDB.DocumentClient(); | |
const tableName = 'Items'; // Your DynamoDB table name | |
// Define your GraphQL schema | |
const typeDefs = ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from 'aws-cdk-lib'; | |
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; | |
import * as apigateway from 'aws-cdk-lib/aws-apigateway'; | |
import * as lambda from 'aws-cdk-lib/aws-lambda'; | |
import * as appsync from 'aws-cdk-lib/aws-appsync'; | |
import * as iam from 'aws-cdk-lib/aws-iam'; | |
const { Stack, App, RemovalPolicy } = cdk; | |
class GraphQLAPIStack extends Stack { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getTree = barcode => { | |
const barcodeLength = barcode.length; | |
const firstTwoDigits = parseInt(barcode.slice(0,2)); | |
const dic = { | |
'bluecypress': {digits: [45,56], length: 8, name: 'Blue Ice Arizona Cypress'}, | |
'palm': {digits: [76, 43], length: 12, name: 'The Palm Tree'}, | |
'maple': {digits: [23, 12,45,54], length: 6, name: 'Maple Trees'} | |
}; | |
OlderNewer