When using browser-sync,why is the browser saying cannot get, while everything seems fine - browser-sync

This is the screenshot of cmd:
I wrote
browser-sync start --server --files "app\index.html"

Looking at your screenshot it appears that your project directory is situated in the Desktop folder and is structured as follows:
confusion
│
└───app
│
└───index.html
In which case you could try instructing Browsersync to start a server from the app directory. If you cd to your folder named confusion then run:
browser-sync start --server "app" --files "app/index.html"
Note the addition of "app" after the --server flag.

Related

PM2 run nodejs sveltekit app with options

I have an app that i bult with npm run build, with sveltekit, everything works fine, but i have to specify the ORIGIN like it says here https://github.com/sveltejs/kit/tree/master/packages/adapter-node, to make it run otherwise i run in to this problem "Cross-site POST form submissions are forbidden".
I run it like this and it works fine ORIGIN=http://myorigin node out/index.js.
Now i need to register it to PM2 but i find nothing to run it with the origin parameter.
I have also tried to set the ORIGIN keu in the .env file, and installing dotenv, but i still need to run this command: node -r dotenv/config build, with options, and i cant make it start from PM2.
Is there a way to do this?
Thanks
i found this and it worked https://pm2.keymetrics.io/docs/usage/application-declaration/
module.exports = {
apps : [{
name : "app",
script : "ORIGIN=http://myorigin node out/index.js"
}]
}

Voice calling won't work on azure and only local

output of "npx webpack-dev-server --entry ./client.js --output bundle.js --debug --devtool inline-source-map" :
Project is running at http://localhost:8080/
webpack output is served from /
Content not from webpack is served from /home/site/wwwroot
https://learn.microsoft.com/nl-nl/azure/communication-services/quickstarts/voice-video-calling/getting-started-with-calling?pivots=platform-web
I tried a sample, so the firewall rules are good !
Using cloud shell it worked to make a web-preview.

Unable to run node application using pm2

I made a small nestjs webapp, it connects to a local mssql database and works fine... Except if I try to launch it using pm2.
regular yarn start:dev works (it translates to nest start --watch)
building the production and running yarn start:prod also works fine (it translates to node dist/main)
running nodemon build/main.js also works fine
But if I try to launch my app running pm2 start build/main.js I get DB connection errors: TypeError: The "config.server" property is required and must be of type string.
My DB connection parameters are currently stored in a .env file. I load them running env.config() and it's working fine for the other three running methods I listed. I've tried to change the parameters to include quotes and double quotes, with no luck:
db_host = localhost
db_host = 'localhost'
db_host = "localhost"
What am I doing wrong?
We just found out that changing the syntax from pm2 start to something like pm2 start npm --name "myApp" -- run start:prod worked.
This can help you, in the documentation says you can use the environment variables in ecosystem.config.js file:
https://pm2.keymetrics.io/docs/usage/environment/

NodeJS App path broken in Docker container

I got this strange issue when trying to run my NodeJS App inside a Docker Container.
All the path are broken
e.g. :
const myLocalLib = require('./lib/locallib.');
Results in Error:
Cannot find module './lib/locallib'
All the file are here (show by ls command inside the lib direcotry)
I'm new to Docker so I may have missed something in my setup
There's my Dockerfile
FROM node:latest
COPY out/* out/
COPY src/.env.example src/
COPY package.json .
RUN yarn
ENTRYPOINT yarn start
Per request : File structure
Thank you.
You are using the COPY command wrong. It should be:
COPY out out

How to serve the default angular seed/tutorial app on the root route?

I'm using the angular tutorial as base to build an app . However when I run npm start I need to go to localhost:8000/app/ to get the app. I would like to change the route so that I can run serve the app on the root path ( localhost:8000/app/) . Where can I configure that ? I've tried to simply move the content from /app into the root but it breaks the npm/build script.
Without running the project myself (it's Sunday after all), it looks like you would need to add the /app path to the start command inside package.json. Also check http-server docs for more on the defaults -
https://www.npmjs.org/package/http-server
Other things may be relying on the root being ./, so there may be some breakage.
Should read something like
"start": "http-server /app --domain 0.0.0.0 --port 8000",

Resources