Add a warning when no AppModule is passed in

Issue #1 resolved
Jorge Ortiz
created an issue

On version 1.0.4, if I fail to pass an AppModule when starting the app, no warning is shown and the "Welcome to BedSheet" page is displayed.

e.g.

$ fan afBedSheet afbsTest 8080

instead of:

$ fan afBedSheet afbsTest::AppModule 8080

I know it is a user error, but it would be helpful to have a warning in the console saying something like "No routes have been contributed or AppModule is missing" and in the Welcome page add something like "Make sure you include the app module when starting the app".

Comments (4)

  1. Steve Eynon

    It is valid to pass in just the pod name like you tried:

    $ fan afBedSheet afbsTest 8080
    

    BedSheet then looks up the module name from the pod's meta:

    "afIoc.module" : "afbsTest::AppModule"
    

    But of course, if no meta exists, no modules are added.

    If no module pod meta exists, perhaps BedSheet could guess a class named "AppModule" and auto-add that if it exists? And warn if it doesn't.

    I also like the idea of logging a warning if no Routes have been contributed.

  2. Jorge Ortiz reporter

    It would be enough mentioning in the Welcome page that it looks up the module name from the pod's meta, but I also like the idea of looking for a default "AppModule" (convention over configuration)

  3. Log in to comment