`
sillycat
  • 浏览: 2552180 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud

 
阅读更多
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud

GraphQL sample codes are in project sales-api.zip.

It is running pretty good with command
> npm run start

To make it working well with Tencent Cloud, I add this app.js
'use strict';

const express = require('express');
const { ApolloServer } = require('apollo-server-express');
const resolvers = require('src/resolver');
const schemas = require('src/schema');
const { getContext } = require('src/context');

const server = new ApolloServer({
  typeDefs: schemas,
  resolvers,
  context: getContext
});

const app = express();
server.applyMiddleware({ app });

module.exports = app

Add this component to make it working on Tencent Cloud:
salesApi:
  region: ap-shanghai
  component: '@serverless/tencent-express'
  inputs:
    region: ap-shanghai
    functionName: sales-graphql
    serviceId: service-qbj6dksl
    serviceName: salesgraphql
    codeUri: ./
    functionConf:
      timeout: 10
      memorySize: 128
    apigatewayConf:
      protocols:
        - http
      environment: prepub
      isDisabled: false

Command will deploy that to Tencent
>sls - - debug

References:
https://github.com/serverless-components/tencent-express/blob/master/docs/configure.md
https://yugasun.com/post/serverless-fullstack-vue-practice.html
https://github.com/serverless-components/tencent-scf


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics