Home>

I'm creating an API that uses AWS Lambda + Node.js Express.
Serverlss-httpI was able to get the communication of get and post by looking at the example of.
However, since 1 file has become longer, I want to divide the process for each file with express.Router, but there is no sample in Serverlss-http, so I am having trouble implementing it. Could you tell me how to use express.Router using Serverlss-http?

Constitution
Folder structure
├─node_modules
└─app.js
└─routes
        test.js
        sample.js

The following is the configuration I want to achieve.

~~~~~~~~~~~~~app.js~~~~~~~~~~~~~
const sample = require('./routes/sample');
const test= require('./routes/test');
const express = require('express');
const app = express();
app.use('/sample', sample);
app.use('/test', test);
~~~~~~~~~~~~~test.js~~~~~~~~~~~~~
var express = require('express');
var router = express.Router();
router.get('/', (req, res, next)=>{
    res.send("test")
});
module.exports = router;
Supplemental information (FW/tool ​​version, etc.)

Node.js 12
Express 4