Question on App Platform?

Hi, I cannot seem to set up a very simple server on App Platform. Works fine locally, but once I deploy it as a web-server on App Platform, the express server seems to run, but not the socket connection.

Here is the simple index.js file:

const express = require('express');
const app = express();
const http = require('http');
const server = http.createServer(app);
const { Server } = require('');
const io = new Server(server);

app.get('/', (req, res) => {
  res.sendFile('index.html', { root: __dirname });

io.on('connection', (socket) => {
  console.log('a user connected');

const PORT = process.env.PORT || 3000;

server.listen(PORT, () => {
  console.log('listening on *:', PORT);

When I try to ping it:

curl "<the server URL>/"

I get no response.

Any ideas?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Maybe it’s a cors restriction issue? Did you try to enable cors params?

Btw we use on the app platform. It works fine for us.

Hey did you ever figure this out? Struggling with this right now.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up