Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder for server + middleware #96

Open
Tracked by #516
korczis opened this issue Aug 5, 2015 · 13 comments
Open
Tracked by #516

Folder for server + middleware #96

korczis opened this issue Aug 5, 2015 · 13 comments

Comments

@korczis
Copy link
Contributor

korczis commented Aug 5, 2015

Hi,
what about creating dedicated folder (src/server) for server implementation?

Also what about moving middleware into dedicated folder (src/server/middleware) and file(s)?

For example:

src/server/middleware/compression.js
app.use(compression());

src/server/middleware/favicon.js
app.use(favicon(path.join(__dirname, '..', 'static', 'favicon.ico')));

What is your opinion?

@erikras
Copy link
Owner

erikras commented Aug 12, 2015

What does this achieve, exactly?

@korczis
Copy link
Contributor Author

korczis commented Aug 13, 2015

Why to move src/server.js to src/src/server.js?

Because I would like to split server implementation in multiple files but have them in same (non-src-root) folder.

src/server <-- folder with server implementation
src/server/middleware <-- folder with middleware implementation

Or do you suggest to have everything in one file (server.js) ? Or to have all stuff in root-src-folder?

@erikras
Copy link
Owner

erikras commented Aug 13, 2015

I'm still not understanding. You're talking about express middleware? This project uses almost no express middleware in server.js. Unless you're wanting to easily flip on and off individual middleware libraries, I still don't see the point. You might have that need in your own project, but for an example library, it seems excessive.

@korczis
Copy link
Contributor Author

korczis commented Aug 13, 2015

I would like to have anything related to server side in one folder. Express middleware, api implementation, etc.

In my opinion this is valuable even for small project. Why? If somebody forks your project he/she can modify it and easily merge updates from upstream (your repo) with almost no hassle.

This is also reason why I created #97

I can move server implementation to another folder and change just one path instead 5 of them (literally).

@bdefore
Copy link
Collaborator

bdefore commented Aug 13, 2015

i'm a little wary of src/src but i'm definitely fond of things that make upstream merges easier. i think there's two competing objectives that this repo takes on: 1) a base from which to build an isomorphic react project off of and 2) an example project that provides implementations of common use cases like authentication and forms. it'd be nice to be able to merge into the features of the first without having to prune out things from the second.

@sseppola
Copy link
Contributor

May I suggest that we just separate the API from the rest of the app?
The reason is that we can decouple the API from the universal app we make it an implementation detail.

This repo could then function as a great starting point for building universal apps independent of the API implementation, and would allow people to:

  1. Build universal apps against existing APIs.
  2. Use the API in this repo as a starting point for their API.
  3. rm -rf ./api

I'm not saying that this is not possible, nor difficult to do now, but it would encourage this separation and make point 1 and 3 easy.

My use case is that I'm building an app based on this repo that I want to scale horizontally, and I'm planning on "dockerizing" the api and the "app server" separately.

If this is of interest for this repo I can give it a shot and create a pull request.

@LarryEitel
Copy link

I looked at MANY react redux projects and have settled on this one from which to build from. I too am working on how to talk to a remote backend API. I too like the idea of making a separation of API from rest of the app IMHO. :)

@codepunkt
Copy link
Contributor

Seems like a smart move 👍

@erikras
Copy link
Owner

erikras commented Sep 15, 2015

Fixed by #190.

@erikras erikras closed this as completed Sep 15, 2015
@erikras
Copy link
Owner

erikras commented Sep 15, 2015

Actually, #190 did not address the original middleware issue. Sorry.

@erikras erikras reopened this Sep 15, 2015
@quicksnap quicksnap mentioned this issue Nov 10, 2015
8 tasks
@lycon2014
Copy link

All are corect in the matter. 1. Dedicated server. with the functionality to bridge merge and split when needed. with manual on an off or switch merge with split API toggle.. if possible I don't know portals run all as one or at ones choice depending on its pertinent intended individual propose. Apps and folders. Partial front and rooted backend romote one core backbone infastrutcre spider .Web like branches/ /vertebra extention. Off the top of my HEAD. .Middelware purpose is as dual second mind hive like attribute CORE MAKING IT UNIVERSAL

@lycon2014
Copy link

If plausible.maybe tangible .programing coding wise..I dont..

@lycon2014
Copy link

Know. FOOD for thought..

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

No branches or pull requests

7 participants