Git Product home page Git Product logo

Comments (6)

lostintangent avatar lostintangent commented on September 17, 2024 2

@naziml Are there any plans to add support for looking for a start script in the package.json file as well? It would be ideal to have that behavior, to alleviate the need to set the startup file as an App Service setting.

from node.

naziml avatar naziml commented on September 17, 2024

Your start command can be set to either a PM2 process file (process.json) or just the startup script of your node app (e.g. bin/www). If your startup script is not set at all, we will try to auto-set in this order:

  1. Check if bin/www exists and set that if it does
  2. Check if server.js exists in site root
  3. Check if app.js exists in site root

If your startup script is not set and we don't find any of the above, we will go to a default splash page (hostingstart.js)

HTH,

from node.

fiveisprime avatar fiveisprime commented on September 17, 2024

👍 to what @lostintangent said. Checking main and scripts.start from package.json would cover most cases.

from node.

fiveisprime avatar fiveisprime commented on September 17, 2024

Is there any reason this logic isn't included in the image?

I noticed that the Ruby image offloads some things to a startup.sh script. This same kind of thing could be done here to determine the correct start file, exec args (i.e. experimental flags passed to the node bin parsed from env vars), or even to detect the start file.

PACKAGE_PATH=/home/site/wwwroot/package.json # Needs a recursive find instead.
MAIN=$(node -pe "require('$PACKAGE_PATH').main || ''" 2> /dev/null || true)
START=$(node -pe "require('$PACKAGE_PATH').scripts.start || ''" 2> /dev/null || true)

# Fall back to testing for local files.
# ...

There's a lot of potential here. :)

from node.

nickwalkmsft avatar nickwalkmsft commented on September 17, 2024

/cc @Hamster-Huey

from node.

nickwalkmsft avatar nickwalkmsft commented on September 17, 2024

Support for detecting scripts.start and running npm start has been added. Closing this, although it won't be deployed to production for a while.

from node.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.