CopyPastor

Detecting plagiarism made easy.

Score: 2; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2025-01-18
by Greg Quinn

Original Post

Original - Posted on 2025-01-18
by Greg Quinn



            
Present in both answers; Present only in the new answer; Present only in the old answer;

For anyone struggling with this, I'd suggest reading through [this article][1] on Azure documentation.

[1]: https://learn.microsoft.com/en-us/azure/app-service/configure-language-nodejs?pivots=platform-linux
The things that caught me were...
1.) Not setting the port correctly, make sure to set the port to the PORT ernvironment variable, or 8080, which seems to be the default for Azure Web Apps.
import express from 'express'; const app = express() const port = process.env.PORT || 8080 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`) })
2.) On dev/local environment, `use tsc && node dist/app.js` to compile your TypeScript and run the output `dist/app.js`. THIS WORKS FOR DEV/LOCAL ONLY AND WILL NOT RUN ON AZURE.
3.) When deploying to Azure, you need to change it to run with PM2.
`pm2 start dist/app.js --no-daemon`
4.) Your scripts section in package.json should look something like this...
"scripts": { "build": "tsc", "dev": "tsc && node dist/app.js", "start":"pm2 start dist/app.js --no-daemon" }
If you're deploying with GitHub actions, then your .yaml file npm install, build and test section should look like this...
- name: npm install, build, and test run: | npm install npm run build --if-present #npm run test --if-present
Azure Web Apps will automatically run `npm start` on deploy, so make sure your start script runs pm2 as I mentioned above.
For anyone struggling with this, I'd suggest reading through [this article][1] on Azure documentation.

[1]: https://learn.microsoft.com/en-us/azure/app-service/configure-language-nodejs?pivots=platform-linux
The things that caught me were...
1.) Not setting the port correctly, make sure to set the port to the PORT ernvironment variable, or 8080, which seems to be the default for Azure Web Apps.
import express from 'express'; const app = express() const port = process.env.PORT || 8080 app.get('/', (req, res) => { res.send('Hello World!') }) app.listen(port, () => { console.log(`Example app listening at http://localhost:${port}`) })
2.) On dev/local environment, `use tsc && node dist/app.js` to compile your TypeScript and run the output `dist/app.js`. THIS WORKS FOR DEV/LOCAL ONLY AND WILL NOT RUN ON AZURE.
3.) When deploying to Azure, you need to change it to run with PM2.
`pm2 start dist/app.js --no-daemon`
4.) Your scripts section in package.json should look something like this...
"scripts": { "build": "tsc", "dev": "tsc && node dist/app.js", "start":"pm2 start dist/app.js --no-daemon" }
If you're deploying with GitHub actions, then your .yaml file npm install, build and test section should look like this...
- name: npm install, build, and test run: | npm install npm run build --if-present #npm run test --if-present
Azure Web Apps will automatically run `npm start` on deploy, so make sure your start script runs pm2 as I mentioned above.

        
Present in both answers; Present only in the new answer; Present only in the old answer;