redstone-dart / redstone

A metadata driven microframework for Dart.
http://redstone-dart.github.io/redstone
MIT License
342 stars 42 forks source link

multi import Route not support? #168

Closed Matrix-Zhang closed 8 years ago

Matrix-Zhang commented 8 years ago

main.dart

import 'dart:io';
import 'package:redstone/redstone.dart' as app;
import 'routes/user.dart';
import 'routes/verify_code.dart';

main(List<String> args) {
  app.setupConsoleLog();
  app.start(address: "0.0.0.0", port: 3000);
}

user.dart

import 'package:redstone/redstone.dart' as app;

@app.Route("/user")
User() => "user";

verify_code.dart

import 'package:redstone/redstone.dart' as app;

@app.Route("/verify_code")
VerifyCode() => "verify_code";

only the first import user route valid...

Pacane commented 8 years ago

How can it be valid? The method has no body. Also, what are you trying to achieve? I'm not sure

Matrix-Zhang commented 8 years ago

sorry. there is something wrong when i copy the code. i want separate many routes to different files such as modules...

platelk commented 8 years ago

Have you tried to put them in a library instead and see if it works ?

Pacane commented 8 years ago

If I were you, I would use groups they're made for that.

If you don't want to, you can make a library, and have your routes in different parts of the library.

On Sat, Mar 19, 2016, 9:38 AM Vink notifications@github.com wrote:

Have you tried to put them in a library instead and see if it works ?

— You are receiving this because you commented.

Reply to this email directly or view it on GitHub https://github.com/redstone-dart/redstone/issues/168#issuecomment-198705312

Matrix-Zhang commented 8 years ago

make them to a library is ok