Serverless tencent hapi component.
Install
- global install serverless
npm install -g serverless
- install hapi
npm install @hapi/hapi --save
Configure
- create
app.js
file:
const Hapi = require('@hapi/hapi');
const app = Hapi.server({ port: 80 });
app.route({
method: 'GET',
path: '/',
handler: (request, h) => {
return h.response({
hello: 'hapi',
});
},
});
module.exports = app;
- create serverless configure file:
# serverless.yml
hapi:
component: '@twn39/tencent-hapi'
inputs:
region: ap-shanghai
Deploy
sls --debug