README_EN.md 3.1 KB

Serverless Vue Tencent Cloud

 

Template - Fullstack Application deployed with Tencent Cloud Services

This is a template for deploying a serverless fullstack application via multiple Serverless Components. This aims to be the simplest possible way to build a serverless fullstack application, including a Vue.js application on the front-end bundled with Parcel and back-end API.

This fullstack application's software stack is completely serverless has the lowest total overhead, and cost. If you are looking for an efficient solution that enables you to build more and manage less (cheaply), there is no better option.

This template includes:

  • A serverless REST API - powered by a single Servelress Cloud Function and a single API Gateway endpoint, which sends all requests to the function, enabling you to do routing and logic all in your code.

  • A serverless website with a Vue.js application - powered by Cloud Object Storage. The backend API endpoint is already passed into the front-end, and the Vue.js application is already configured to use it.

 

 

  1. Install
  2. Create
  3. Deploy
  4. Development
  5. Notes

 

1. Install

Install the Serverless Framework:

$ npm i -g serverless

Next, use the create --template-url command to install a tencent-fullstack-vue-application.

$ serverless create --template-url https://github.com/serverless/components/tree/master/templates/tencent-fullstack-vue-application

2. Create

Just create .env file:

$ touch .env # your Tencent API Keys

Add the access keys of a Tencent CAM Role with AdministratorAccess in the .env file, using this format:

# .env
TENCENT_SECRET_ID=123
TENCENT_SECRET_KEY=123
  • If you don't have a Tencent Cloud account, you could sign up first.

Or, you can set these as environment variables manually before deploying.

Install the NPM dependencies in the front-end dashboard and backend api directories:

$ npm i

Move/Create your file in the folder, and the directory should look something like this:

|- api
|- dashboard
|- serverless.yml      # Inside the repo
|- .env      # your Tencent SecretId/Key/AppId

3. Deploy

Deploy via the serverless command:

$ serverless

Use the --debug flag if you'd like to learn what's happening behind the scenes:

$ serverless --debug

4. Development

After your first deployment, you will be able to run the front-end locally and have it communicate to the live back-end, in the cloud.

$ cd dashboard && npm run start

New to Components?

Checkout the Serverless Components repo for more information.