Skip to content
This repository was archived by the owner on Aug 9, 2018. It is now read-only.

Express depency is bad #29

Open
salarelv opened this issue Dec 8, 2015 · 4 comments
Open

Express depency is bad #29

salarelv opened this issue Dec 8, 2015 · 4 comments

Comments

@salarelv
Copy link

salarelv commented Dec 8, 2015

Is it possible to run this without express...I am already using another server side router.

@apparentlymart
Copy link
Collaborator

AngularJS-Server does not depend on express's router, so using a different router might work.

It's possible that the middleware functions in this library make use of the express extensions to the request and response objects; I'm not sure since we've never tried this code without express.

If the included middlewares don't meet your needs then it's possible to interact with AngularJS-Server at a low level that doesn't care about middlewares at all, using the runInContext method. That will create an Angular $injector and pass it to your code, allowing you to then interact with AngularJS however you like. Using this mechanism you could implement your own variant of the middlewareWithAngular method that initializes the Angular context using whatever mechanism you like.

@salarelv
Copy link
Author

salarelv commented Dec 9, 2015

Ok. But is it possible to remove the express dependency from package.json. Probably the weather example should be moved to another repo.

@salarelv
Copy link
Author

salarelv commented Dec 9, 2015

Also the weather app isn't working.

@kylecordes
Copy link

Related to this discussion of express dependency: I think they are worthwhile use cases for this tool where it is used only during a build process. It could create an initial static rendering starting point for an application, with the contents to be replaced by angular at run time. This has several benefits:

  • In case of any error while running the JavaScript, it is likely that the initial statically rendered page is more useful than a blank page.
  • The user may find something worthwhile to look at on the statically rendered page, while waiting (hopefully briefly) for the real content to load.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants