Dart best practices for develop and production - dart

Sorry if this is a noop question, but I'm pretty new to Dart.
I wonder if someone has good links or ideas for best practices for develop and debug a Dart application in a node.js environment. I can start a standalone Dart app and call a rest api using absolute url, but I think the Dart app should be served using node.js and the urls should be relative. In production we also need to serve the js compiled app. Do you know how to build a good development environment, near to production?

You can create a launch configuration in DartEditor to be able to use the debugger with another web server.
https://code.google.com/p/dart/issues/detail?id=3748 (sorry couldn't find a better ressource)
The Dartium built in debugger (Chrome developer tools) works pretty well too with Dart.
You will loose some features like transformers as pub serve uses it though.
I guess the best for development is to set Access-Control-Allow-Origin header in your node.js server and develop with the web server built in in DartEditor (dart: debugging client/server communication for dart client and existing rest api?).
For testing and bug-fixing in an environment similar to the deployment environment use the configuration described above.
Dart is just like static files for the server. You don't loose much when you don't use node.js for serving Dart.

Related

Using pub serve with ASP.NET Core backend

I'm using Dart to build JS applications that are loaded on web pages hosted from an ASP.NET Core application, and I'm trying to establish a development workflow with either pub serve or potentially pub build that allows for debugging. I've seen some related posts, but I'm still stuck. This is what I've tried:
I used pub build with dart2js and the --mode=debug flag set to generate dart sources and a sourceMap, and then used Chrome to load and debug the web pages. The problem here, apart from long compile times, is the sourceMaps don't seem to work well for the debugging. Lines in the .dart files are often unavailable for debugging, and stepping over function calls doesn't work well, instead diving into framework code. I'm also unable to see values reported reliably.
I used pub get with the --packages-dir flag to copy in dependencies and then loaded the web pages with Dartium hosted by the IIS Express server. This loads pages fine and lets me develop, but I was unable to get breakpoints working at all in Dartium unless I used the debugger() statement directly in my code. I'm also concerned about this approach in general because Dartium is no longer being updated and the Dart team's plan is to move away from it.
As an offshoot of #2, I also tried simply changing my script tag URLs in my ASP.NET pages to point to the resources on the pub serve dev server. This is blocked because pub serve apparently only serves on http, and the ASP.NET application is hosted via HTTPS locally. I tried to change the backend to load on HTTP, but now I'm running into issues with authentication/authorization not working in my .NET app. Also, I had hoped to be able to use dartdevc with this approach, but that gave me 404 errors with requirejs, I think because it was trying to load it from the IIS Express server instead of pub serve (I'm really not sure about that).
I've found some mentions in other StackOverflow posts of setting up some sort of proxying behavior in order to have a backend server request resources from pub serve, but I have no idea how this might be done or if it applies to this situation. I can't find any information.
What strategies are people using for this, and is there a best-practice in mind going forward with Dart 2.0 and dartdevc?

What is the best way to integrate Aqueduct server with an existing client based Dart webapp?

I am trying to link an aqueduct server with my existing dart project. I am aware of aqueducts HTTPFileController and how you can serve static files, but I was looking for insight on the best way to integrate a full client side web app written in dart with the aqueduct framework. I.e. making API method calls from the component which say return a list of users or something like that. The RPC package offers something like this, but I would like to use aqueduct as it is more robust and offers more features.
Currently my overall project structure looks like: Any suggestions are appreciated!
my_proj
build
lib
components
(dart components serving html)
controller
(aqueduct controllers)
model
(aqueduct models)
my_proj.dart
my_proj_sink.dart
migrations
test
web
main.dart
index.html
It's a good idea to keep the projects separate. This way you can have separate dependency constraints for both platforms, which will end up being meaningful as your application grows. It will give you the most flexibility in deployment, too.
Here's an example repository; these are works in progress, so the Flutter application is hooked up to the Aqueduct API, while the Angular2 app hasn't been touched. Flutter has a similar component-like approach.
The shared directory will be most interesting to you - it has the model and services for making calls to the API. Both the Flutter and Angular2 apps use it as a dependency.
In this example, the server is run with aqueduct serve --port 8082 from server/ and the web application is run with pub serve from angular2/. As the Dart ecosystem evolves with things like the DDC, you'll likely be best served by adopting a development/deploy pattern like this that works within that toolchain.
If you are planning on serving the generated HTML/CSS/JS files from Aqueduct, a good idea is to have an HTTPFileController reference the build/web folder in your Angular2 project. So, you might have a folder structure like:
project/
server/
pubspec.yaml
lib/
sink.dart
controllers/
model/
client/
pubspec.yaml
lib/
web/
And your route hookup looks like this:
router
.route("/*")
.pipe(new HTTPFileController("../client/build/web"));
Another approach is to have a build script that writes the files into a directory inside the server directory; this might be useful for deploying.
The Aqueduct team is currently looking at different options and building tools for this purpose. With the recent release of DDC, we are focused more on providing a toolchain that works with it. (I'll also see if one of our team members focused on this part of the puzzle can drop in here with some additional thoughts.)
Please feel free to file an issue for this as well so you can track its progress. Likewise, we have folks in Gitter dart-lang/server that answer quickly. Hope this helps.

Can Selenium webDriver Python bindings test a Ruby on Rails website?

Can Selenium webDriver Python bindings test a website developed in Ruby on Rails ? Also will I be able to use Firebug to know the id etc. of the webwlements of that website? I am very new to web test automation. Any help would be appreciated.
Can Selenium webDriver Python bindings test a website developed in Ruby on Rails ?
Yes, but if you write the tests in the code of the project if you encounter any issues you could always ask a dev who is familiar with the code base. When you use another language you're risking having a resource familiar with the language to ask.
Also will I be able to use Firebug to know the id etc. of the webwlements of that website?
Yes you can use firebug to find the css id, xpath, etc. If you're using Chrome the web developer settings has these features built in.
It doesn't matter for the driver whats the underline technology powers the site under test. That being said if you want to hook up into the back end for better reporting etc it would be easier to do with the same language

How to call Java EE SOAP or REST services from mobile platform. etc Dxtreme, Jquery Mobile, Icenium

I want to develop mobile apps based on HTML, JS. It must work on any device etc iphone, ipad, android and windows phone...
I must use JAVA EE on server side. First I choosed Dxtreme. after I learned dxtreme, it is possible REST Service using ASP.NET Web API. But it is inpossible on Java EE. following error :
But call along #POST, #PUT and #DELETE methods throws error
"XMLHttpRequest cannot load http://www.restserver/Service/item. Origin
http://www.localhost:51140 is not allowed by Access-Control-Allow-Origin".
I believe there must be something that people must be using SOAP or REST Service on Mobile.
Which mobile framework is it possible ?
Please help me.
Thanks.
have You read About Phonegap?U can use phonegap to build application that can work around different Mobile platform.Its uses HTML5,CSS3,Javascript.Hope this helps you......
Generally, people access web services using RESTful interfaces on the server end. You can create that with ASP.NET Web API and many other server side frameworks of course. Your error, I'm guessing, but not sure, is from your client application. If I'm correct, you are probably running some simulator or the app within a browser client, and not one of the mobile framework simulators, and are running into the problem where the browser restricts your access to services on systems other than the site your started with. I.e. if you got to myboringwebpage.com and try to look up something on api.twitter.com within the app, the browser will stop you unless you add certain things to your web server/page telling the browser that that is OK. Look up "CORS". With Icenium, if you use the browser development environment "Mist" you will get those issues. If you use the Windows environment "Graphite" there is no such restriction. If you use the Intel HTML5 XDK at http://html5m.com/, it runs some process to get around those issues, while running a simulator in a browser. If you end up building PhoneGap apps, which you can using Icenium, appery.io, Intel HTML5 XDK, PhoneGap Build and others, the built app, installed on the phone, will not be restricted as an in-browser "app" would. However, I had problems with the Intel framework's XHR code handling all the different methods. Sorry this probably doesn't cover everything you need - you'll have to live and learn a lot of this.

Dwscript web server

I want to use dwscript for web programming ( generating dynamic content). I was wondering if there is any module for apache web server? Or how can I run my own web server based on dwscript?
I'm not (yet?) familiar with DWScript, but I've created an Apache module that runs a Delphi-compiled module that serves a web-site over an abstract interface, so it can plug into IIS or InternetExplorer also. There are also versions that auto-recompile when it detects changes to the source-code, so you can develop and test by hitting refresh in the browser window:
http://xxm.sourceforge.net/

Resources