1 回复
// 云函数入口文件
const cloud = require(‘wx-server-sdk’);
const TcbRouter = require(‘tcb-router’);
cloud.init()
const db = cloud.database();
const _ = db.command;
// 云函数入口函数
exports.main = async (event, context) => {
const app = new TcbRouter({ event });
/**
* 登录
*/
app.router(‘login’, async (ctx, next) => {
await next();
}, async (ctx, next) => {
await next();
}, async (ctx) => {
const login = require(‘login/index.js’);
ctx.body = login.mian(event, context, db, _);
});
return app.serve();
}
安装相关依赖右键上传上去即可