Create a data structure that will implement the below interface.
Plan { planId: string; planType: string; planYear: int; planName: string; }
const typeDefs = gql` | |
type File { | |
filename: String! | |
mimetype: String! | |
encoding: String! | |
} | |
type Query { |
const resolvers = { | |
Mutation: { | |
singleUpload: (parent, args) => { | |
return args.file.then(file => { | |
const {createReadStream, filename, mimetype} = file | |
const fileStream = createReadStream() | |
fileStream.pipe(fs.createWriteStream(`./uploadedFiles/${filename}`)) |
const { ApolloServer, gql } = require('apollo-server'); | |
const AWS = require('aws-sdk') | |
const fs = require('fs') | |
AWS.config.loadFromPath('./credentials.json'); | |
const s3 = new AWS.S3({apiVersion: '2006-03-01'}); | |
const typeDefs = gql` | |
type File { |
const apolloCache = new InMemoryCache() | |
const uploadLink = createUploadLink({ | |
uri: 'http://localhost:4000', // Apollo Server is served from port 4000 | |
headers: { | |
"keep-alive": "true" | |
} | |
}) |
const UPLOAD_FILE = gql` | |
mutation SingleUpload($file: Upload!) { | |
singleUpload(file: $file) { | |
filename | |
mimetype | |
encoding | |
} | |
} | |
`; |
import React from 'react'; | |
import logo from './logo.svg'; | |
import './App.css'; | |
import { InMemoryCache } from 'apollo-cache-inmemory' | |
import { createUploadLink } from 'apollo-upload-client' | |
import {ApolloClient} from "apollo-client" | |
import {ApolloProvider, Mutation} from "react-apollo" | |
import gql from "graphql-tag" | |
const apolloCache = new InMemoryCache() |
There are several cards arranged in a row, and each card has an associated number of points
The points are given in the integer array cardPoints.
In one step, you can take one card from the beginning or from the end of the row. You have to take exactly k cards.
Your score is the sum of the points of the cards you have taken.