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 年前檢視次數 670 次
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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南