Serverless-http timeouts on netlify functions local enviroment

I’ve tried to develop some APIs. Just make a simple test code. But not worked.

const express = require('express')
const serverless = require('serverless-http')
const app = express()

app.use(bodyParser)

const test = () => {
    return 'This is test'
}

app.get('/test', (req, res) => {
    res.send(test)
})

module.exports = app
module.exports.handler = serverless(app)

Error message was

Task timed out after 10.00 seconds

Anyone has good idea?

Hi @kohki-shikata

All serverless function time out after 10 seconds by default (an increase to 26 seconds is possible.)

Serverless functions aren’t meant to run as servers.

Here is a very basic example of a serverless function from Netlify Functions Playground

exports.handler = function (event, context, callback) {
  callback(null, {
    statusCode: 200,
    body: "Hello, World",
  });
};

Thank you coelmay.

From what my understand, the package serverless-http converts legacy express code to server-less code. Is this incorrect?

Of course, I tried the source what you described. I can understand it is for basic use.

I need to make some API endpoints with URL routing. I use express if it can.

Is the plan what I explained achievable on Netlify Fuctions?

I have never used serverless-http so I can neither confirm nor deny this.

If you are wanting to make a RESTful API with Netlify functions, I suggest reading over following threads I recently posted in this topic