I want to run the "node server.js" and start the server with terminal on the amplify hosted app

1

I am new to Amplify and development. I am hosting a server that is located in file "server.js" in the root of my Amplify app. It can be start on localhost with the console command "node server.js" when present in the root folder of my app (the file server.js is located in my root app folder).

I push my project to GitHub , and connected it with Amplify.

I can run this server on localhost but I cannot :

  1. find my app files hosted on the server
  2. how can I access my files on amplify server with terminal?
  3. if I access the server with terminal then I hope I will be able to run console "node server.js" command to start the server online.

Please let me know if anyone have a clue.

Mario
已提问 1 年前671 查看次数
2 回答
0

So amplify isn't a server. It's a service. And one meant for deploying your UI, not the backend. To run your server you would need to use a different service like EC2, ECS or beanstalk. From the FAQ

AWS Amplify consists of a set of tools (open source framework, visual development environment, console) and services (web app and static website hosting) to accelerate the development of mobile and web applications on AWS.

See here for more details about amplify https://aws.amazon.com/amplify/faqs/

profile picture
已回答 1 年前
0

Amplify is usually used for front-end applications, not backend HTTP servers. But, Amplify does support Server-side Render.

Try updating your CI backend build pipeline to execute a custom script instead of the built-in one:

backend:
  phases:
    build:
      commands:
        - sh scripts/amplifyPush.sh

The custom scripts/amplifyPush.sh can have whatever you need for running your NodeJS application.

I hope this helps.

已回答 1 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则

相关内容