When running a Dart web app in WebStorm, the "Pub Serve" tab on the ? pane at the bottom reports the following (--port differs from run to run):
/home/tom/dart-sdk/bin/pub serve web --port=46247
Loading source assets...
Loading polymer transformers...
Serving polymer_and_dart web on http://localhost:46247
However, the app will be accessible at http://localhost:63342.
Yet when I run pub serve from the command line, the app will be accessible at localhost:46247:
/home/tom/dart-sdk/bin/pub serve web --port=46247
Can someone explain what WebStorm is doing at the specified port, if it is not to serve the app?
BTW, I am using only Dartium in development.
WebStorm has an integrated proxy that listens on its own port and just forwards to the port pub serve is listening on.
pub serve will be removed in Dart 2.
Currently 4/2018 there is no integration of pub run build_runner serve with IntelliJ but it is work in progress.
Webstorm 2018.1 seems to do something a little different from a proxy. Webstorm runs a web server at the debug port that will respond with a 302 redirect when it receives a GET http://localhost:{{debugPort}}/web/web/{{targetPage}}. The redirect's Location header will refer to the actual location of the target page in the Dart web app.
If, by some chance you need to get the random port programmatically during development, you can enable "Allow unsigned requests" in the Webstorm debugger settings and then write some scaffolding code to get the Location header.
Related
I have quite big Angular Dart project in PhpStorm. I was able to debug it, but suddenly it doesn't work anymore (for few weeks). I'm not sure what's the reason as I upgraded PhpStorm, Dart Plugin and Dart. But I expect debug to be working with all updates.
I created the simpliest Angular Dart app (ToDo example) to see if it helps. It didn't.
Dart VM version: 2.3.1 (Tue May 21 19:28:38 2019 +0200) on "linux_x64"
PhpStorm 2019.1.2
Build #PS-191.7141.52, built on May 8, 2019
JRE: 1.8.0_202-release-1483-b49 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 5.0.17-300.fc30.x86_64
PhpStorm Dart plugin v191.7221
Google Chrome Version 74.0.3729.169 (Official build) (64bit)
Dart is listening on port 53322 for HTTP connections from browser, PhpStorm is listening on debug port 63344 (and has a connection from Chrome), Chrome is listening on debug port 45389 (and has a connection from PhpStorm).
When I open http://localhost:53322/index.html I see the app, but the execution is not stopped on breakpoints.
I've found similar bugs (https://youtrack.jetbrains.com/issue/WEB-30593, Angular dart on WebStorm. Debug is no more working) but the provided solutions didn't help.
Is there a way to make debug working again? I'd like to avoid downgrading.
Not specific to Angular - debugging web apps doesn't work with SDK 2.3.1. Please follow WEB-39095 for updates.
Workarounds:
Start debug session from WebStorm. Breakpoints won't work. Stop Debug
session.
Without closing the project go to Terminal and run pub global activate webdev 1.0.1.
Start debug session from WebStorm again. Breakpoints should work.
Or:
Run webdev server manually from Terminal explicitly specifying hostname, for example: pub global run webdev serve --hostname 127.0.0.1 web:53322
In the IDE create JavaScript Debug run configuration that opens webdev URL directly, e.g. http://localhost:53322/index.html, press Debug
Update: it was a bug in webdev (no sourcemaps on ipv4). Bug is fixed in webdev 2.0.7. No actions needed, WebStorm will auto-update webdev automatically to the latest version
I am trying to run a loopback based application inside by electron app. I was successful in configuring SQLite into loopback and also DB migration inside the app. The server runs fine inside electron in debug mode and I am able to access API endpoints that I created. But when I package the app and run the .app file, the server starts up fine but there are no API endpoints. Here is the link to code: https://github.com/sahilanguralla/daakiya
Is there a way to run an Electron app's UI on a different port? I have an app server (Wildfly) running on port 8080 and when I start the Electron app the app server default page is shown within the Electron app window. I believe that Electron runs on port 8080 in the background. Is there a way to change that to i.e. port 9000?
An Electron app is basically a Chromium browser with NodeJS support which loads any file you want to display from disk. It does not start any server (neither HTTP nor anything else).
With "default app page" I believe you mean the index.html file of the electron-quick-start project. This file, for example, gets loaded in main.js, line 16 using Electron's BrowserWindow#loadFile (...) function. This basically behaves equivalently to loading it using #loadURL ("file:///...") or by using file:// in your browser to load any file from disk.
to do with the files in the build/web folder in my dart app to deployed a in the server as Javascript?
I want to deployd my app but as javascript. But i don't know the correct procedure.
I have configured my project and I called in my localhost
build pub
has generated the folder
build / web
What is the next step to run my dart app as Javascript on the server?
or I should be call build pub on the server?
You should grab all files inside this build / web folder and put them into static-served folder of your server (for Apache it is often htdocs folder).
Than you should be able to open html file of your app and get app working.
I just install dart on my server Ubuntu 12.04. I started on mydomain.com:8080/ and "hello word" displayed. But for real web app I need to run on address mydomain.com (without :8080). When I try to set port 80 on dart script it failed because apache already run on port 80. Here is my current dart script: https://www.dartlang.org/dart-by-example/#http-server So how can I do it?
If you want your Dart app to bind to port 80 you have to stop Apache or bind Apache to another port.
Another solution is to make Dart run by Apache http://news.dartlang.org/2012/05/run-dart-in-apache-web-server.html (didn't read or try myself)
You could use Apache as a proxy (via mod_proxy) to your Dart based webserver. It allows you to have both the power of Apache and Dart on the same device. I haven't used this approach in combination with Dart yet, but I use it with Java applications on Tomcat. Here is a simple Tomcat related example (scroll down to "Configure mod_proxy"). It should be easy to apply that to a Dart based server.
But that might not work with Websockets. The good thing about Websockets is that they aren't limited by the same origin policy, so you can run your Websocket applications on another port.