0.0.1 • Published 4 years ago
scf-service-router v0.0.1
SCF Service Router Starter
Use cases:
Your cloud function code:
const SCFRouter = require('./lib/scf-service-router');
exports.main = async (request, context) => {
const app = new SCFRouter(request);
app.use(async (req, next)=> {
// middleware
next();
});
app.get('/test/:user',async (req) => {
return req.params;
});
app.post('/login', async()=> {
// return something
});
// if there is no mapping routers
app.use(async (req, next) => {
throw new Error('no mapping routers');
});
return app.serve();
}
0.0.1
4 years ago