Deploying on platform.sh (middleware?)

I am running a dev server instance with platform.sh at https://www.master-7rqtwti-iin5x4pvtoxre.us-4.platformsh.site/

After building the app (npx frontity build) I get a server.js file which has to be used as middleware by platfform.sh to render the final result.

I am getting a 502 Bad gateway error, probably because I am missing something setting the YAML files to get server.js as a middleware.

server.js is in place https://www.master-7rqtwti-iin5x4pvtoxre.us-4.platformsh.site/server.js

Does anyone have experience with setting up middleware on platform.sh (using workers or adding a third party library)?

beside this, the project is perfectly working in local

here is the .platform.app.yaml file as a reference:

name: app
type: 'nodejs:14'
hooks:
            build: |
        npx frontity build
web:
    commands:
        start: npx frontity serve
            locations:
                    '/':
                        root: 'build'
disk: 512