Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

Improve documentation: Redstone with GAE #49

Open
cgarciae opened this issue Nov 19, 2014 · 9 comments
Open

Improve documentation: Redstone with GAE #49

cgarciae opened this issue Nov 19, 2014 · 9 comments
Milestone

Comments

@cgarciae
Copy link
Contributor

Can you use Redstone in Google App Engine? If so, can you give me a "Hello World" example to start using it?

@luizmineo
Copy link
Member

To be honest, I didn't have the time yet to play with appengine, but in theory, you can easily use Redstone with it. The trick is that you can't call the start() function directly to start the server. Instead, you have to call setup() to install the handlers, and then call handleRequest() for every request received. Example:

import 'dart:io';
import 'package:appengine/appengine.dart';
import 'package:redstone/server.dart' as app;

@app.Route("/")
helloWorld() => "Hello, World!";

main() {
  app.setupConsoleLog();
  app.setup();
  runAppEngine((req) => app.handleRequest(req));
}

I will update this issue when I test it better, but let me know if this example works for you.

@cgarciae
Copy link
Contributor Author

Do you have to do anything special when deploying?

@cgarciae
Copy link
Contributor Author

@luizmineo app.setup doesn't exist, did you mean app.start or app.setUp?

BTW: it easier to simply call runAppEngine (app.handleRequest)

@luizmineo
Copy link
Member

My bad, it's app.setUp(). You need to call this function, or your handlers won't be installed. Also, I don't think you need to do anything special on deploy.

@cgarciae
Copy link
Contributor Author

@luizmineo I was following the Wiki and it says to deploy/build with ginder. I got an error trying to use grinder but the method above worked, so when do you have to use it?

@luizmineo
Copy link
Member

grinder is useful when you deploy your app to your own server. Services like heroku, appengine and dartvoid usually handles the build and deploy process for you, so you don't need a build script

@digizen
Copy link

digizen commented Nov 22, 2014

I also got an error using Grinder. After some debugging, I found that the error it throws is because it's trying to execute "pub" which it can't find. Any ideas?

@luizmineo
Copy link
Member

@digizen try to set the ``DART_SDK` environment variable and see if that helps

@digizen
Copy link

digizen commented Nov 30, 2014

No dice, the DART_SDK variable was already set to my Dart install folder. It's almost like the "pub" command isn't on the path, but this is also false - I can execute "pub" from the command line. I wonder where Grinder searches for files to execute, and if there's any way to tell it the location of "pub"?

@luizmineo luizmineo changed the title Redstone with GAE Improve documentation: Redstone with GAE Dec 24, 2014
@luizmineo luizmineo added this to the v0.6 milestone Jan 11, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants