Skip to content

twn39/tencent-fastify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Components

Serverless tencent fastify component.

Install

  1. global install serverless
npm install -g serverless
  1. install fastify
npm i --save fastify

Configure

  1. create app.js file:
const fastify = require('fastify');

const app = fastify();
app.get('/', (request, reply) => reply.send({ hello: 'world' }));

if (require.main === module) {
  // called directly i.e. "node app"
  app.listen(3000, (err) => {
    if (err) console.error(err);
    console.log('server listening on 3000');
  });
} else {
  module.exports = app;
}
  1. create serverless configure file:
# serverless.yml

fastify:
  component: '@twn39/tencent-fastify'
  inputs:
    region: ap-shanghai

Deploy

sls --debug

Have fun !