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.
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
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
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
Deploy via the serverless
command:
$ serverless
Use the --debug
flag if you'd like to learn what's happening behind the scenes:
$ serverless --debug
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
Checkout the Serverless Components repo for more information.