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
| export class AWSS3Uploader implements IUploader { | |
| private s3: AWS.S3; | |
| public config: S3UploadConfig; | |
| ... | |
| private createDestinationFilePath( | |
| fileName: string, | |
| mimetype: string, | |
| encoding: string |
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
| resolvers: { | |
| ... | |
| Mutation: { | |
| singleUpload: s3Uploader.singleFileUploadResolver.bind(s3Uploader) | |
| } | |
| } |
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 { AWSS3Uploader } from './s3' | |
| const s3Uploader = new AWSS3Uploader({ | |
| accessKeyId: process.env.AWS_ACCESS_KEY, | |
| secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | |
| destinationBucketName: 'my-really-cool-bucket' | |
| }); |
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
| export class AWSS3Uploader implements IUploader { | |
| private s3: AWS.S3; | |
| public config: S3UploadConfig; | |
| constructor(config: S3UploadConfig) { | |
| AWS.config = new AWS.Config(); | |
| AWS.config.update({ | |
| region: config.region || "ca-central-1", | |
| accessKeyId: config.accessKeyId, | |
| secretAccessKey: config.secretAccessKey |
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
| export type File = { | |
| filename: string; | |
| mimetype: string; | |
| encoding: string; | |
| stream?: ReadStream; | |
| } | |
| export type UploadedFileResponse = { | |
| filename: string; | |
| mimetype: string; |
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 AWS from "aws-sdk"; | |
| type S3UploadConfig = { | |
| accessKeyId: string; | |
| secretAccessKey: string; | |
| destinationBucketName: string; | |
| region?: string; | |
| }; | |
| export class AWSS3Uploader { |
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 { ApolloServer, gql } from 'apollo-server' | |
| const server = new ApolloServer({ | |
| typeDefs: gql` | |
| type Query { | |
| hello: String! | |
| } | |
| type UploadedFileResponse { |
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 { ApolloServer, gql } from 'apollo-server' | |
| const server = new ApolloServer({ | |
| typeDefs: gql` | |
| type Query { | |
| hello: String! | |
| } | |
| `, |
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
| enum SpotType { | |
| Bar, | |
| Restaurant, | |
| Cafe, | |
| Mall | |
| } | |
| enum SoundType { | |
| Chatter, |
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
| """ | |
| Here's what the resulting User type looks like | |
| """ | |
| type User { | |
| "A globally unique id for the user" | |
| id: ID! | |
| "The user's full name as provided" | |
| name: String | |
| "The account username of the user" |