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


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.

asked a year ago433 views
2 Answers

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
answered a year ago

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:

        - sh scripts/amplifyPush.sh

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

I hope this helps.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions