In Vane Roadmap:
Better support for running Vane on localhost. Right now it's certainly
possible to run Vane on localhost, but it's a little bit tricky. On
DartVoid we autogenerate a dart based server using the http_server
package. And all you need to initialize a Vane class is a standard
HttpRequest object. So, this will come soon hopefully. You can find
your autogenerated server.dart file at the root of you app if you have
a DartVoid app (it's not generated if you use a different framework).
I've created Guestbook sample application and file server.dart was missing.
Is Guestbook sample DartVoid app?
Can I reach generated server.dart file via GitHub?
Is there another way to reach this file?
Please create tags for Vane and DartVoid...
File can be reached from application:
import 'dart:async';
import 'dart:io';
import 'package:vane/vane.dart';
String collectionName = "posts";
class GetAllPosts extends Vane {
Future main() {
log.info("Guestbook : GetAllPosts");
new File("server.dart").readAsString().then((String fileContent){
log.info(fileContent);
});
return end;
}
}
Content of file will appear in system console in http://manage.dartvoid.com
TL;DR
Vane doesn't need an auto-generated server.dart file anymore, which makes it super easy to use.
Long answer
As the co-founder of DartVoid and a co-author of Vane maybe I can give a small update on how we have improved Vane's routing.
We have since the OP's question moved away from auto-generating a server file and instead we use annotations to declare Routes. At startup we parse these routes to build the 'routing table'.
If you're interested in knowing the gritty details and see a couple of examples, I recommend that you head over to the project repository at:
https://github.com/DartVoid/Vane
Related
I've got a Dart application that consists of both client and server components. There are a couple of source files that are needed by both client and server. I'm trying to find a way to share them effectively without publishing a library to pub.
I've read through these docs but it doesn't say how to share a library if you don't want to publish it to pub. I'd like to do something like:
import 'package:../../Shared/lib/shared.dart';
But that doesn't work ("Target of URI does not exist").
What options do I have here?
Ah, I figured it out. I have to declare a dependency in my pubspec.yaml like this:
shared:
path: ../shared
Then I can just do this:
import 'package:shared/shared.dart';
There is a mention in the docs of using the logging package to create a proper logger service. Given the features in the logging package it would be nice to be able to get the angular component tree as the logger full name.
I tried to play a bit with the dependency injection system to get the injector tree, so that I could reconstruct the app structure for the loggers. But this proved to be too tricky.
Is there a way to do this, or alternatively, is there a canonical logger service that I could use? It seems to be a pretty basic feature so it must be available somewhere.
I'd look at the logging package for help here.
This is not Angular-specific, but it supports tested loggers.
I don't know where is the problem. This error show up when I import my SystemCheck class to main Dart file.
SystemCheck class:
import 'dart:io';
class SystemCheck{
getOperatingSystem() => Platform.operatingSystem;
getUser() => Platform.localHostname;
}
Import in main file:
import 'cz.felguide.core/system.dart';
That's correct. You cannot use dart:io in Dartium or code designed for running in the browser. For this simple example much of what you want can be found in the Navigator class such as Navigator.platform
Dart has the same limitations as Javascript in that code that is running in a browser cannot natively access the File System of the running client. There are some exceptions such as the specialized Chrome Packaged Apps which allow certain permissions just within Chrome. Even then they require the app to specifically request the extra permissions and the user to grant them.
I have the Play! application running as a windows service. It is implemented according to this guidance.
The problem is that the RUNNING_PID at the root folder of the application is not removed when the server is restarted and the application cannot start again. I have to remove this file and start the service again manually.
Is there any option to solve it?
YAJSW
In case of YAJSW I found this answer with better understanding. It's of course pretty similar to link you gave, anyway keep in mind that it's more often advised to use dist command instead of stage as it has got better developers attention (more bugs fixed in dist). And Mikhail's answer is just clearer (vote him up!)
RUNNING_PID
In case of RUNNING_PID, there was some pull requests which suggested to add an option of disabling pidfile... anyway as I can see, none of them was accepted still...
Actually if you can't avoid creating it, you can... remove it right after application's start, preferably with Globals object's onStart() method. To stay informed what is current PID of the working instance, just rename the file to something, which won't be checked by Play at the startup - for an example RUNNING_PID_INFO. In such case after server's restart service will run your application without problems.
import play.GlobalSettings;
import java.io.File;
public class Global extends GlobalSettings {
#Override
public void onStart(Application application) {
File pidFile = new File("RUNNING_PID");
pidFile.renameTo(new File("RUNNING_PID_INFO"));
}
#Override
public void onStop(Application application) {
File pidFile = new File("RUNNING_PID_INFO");
pidFile.delete();
}
}
(note: changing pidfile.path in apllication.conf will NOT solve the problem, as play will use that for checking if instance is working).
Since Play Framework 2.1 you can disable the PID file by setting the pidfile.path property:
Windows:
-Dpidfile.path=NUL
Unix:
-Dpidfile.path=/dev/null
Found at https://groups.google.com/forum/#!topic/play-framework/4amD9o37Ki4
I recently installed a play framework app using YAJSW by following this answer. I noticed that now, RUNNING_PID is automatically deleted and you don't have to worry about modifying your code to delete the file. Also, if your service depends on other services, it is better to set DELAYED_AUTO_START as the start mode to ensure the service is properly started after server reboot.
Currently I'm connecting to my meteor project using http://localhost:3000 which uses my meteorApp.html file.
How could I make Meteor respond to the following url:
http://localhost:3000/otherPath ?
To be more explicit, I do have a file on the server side I just would like to be able to retrieve on the client side using http://localhost:3000/nameOfTheFile.sufix
I think you can just put nameOfTheFile.sufix under public directory.
See http://docs.meteor.com/#structuringyourapp
If you want otherPath to be within meteor app, public won't do.
There are several ways to do that, http://multi-page-config.meteor.com is one way to create what looks like a traditional multipage site within one meteor process.
I did this a while ago and have since perfected it a bit but haven't updated it.. this at least might give you some ideas... you can look at the source here: https://github.com/bolora/multi-page-config