-
-
Notifications
You must be signed in to change notification settings - Fork 365
Conversation
Note how the _public folder is the unused one |
Reviewing this now @rafaelklaessen first thoughts... WOW
Outside of simply |
api/controllers/pr/index.js
Outdated
@@ -0,0 +1,51 @@ | |||
'use strict'; | |||
|
|||
const _ = require('lodash'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't appears to be used so can be removed.
That would be fine for development, but I meant the actual deployment. Originally you had 1 server, now you'll need 2 (static file server for React and a server for the backend). |
api/controllers/pr/index.js
Outdated
const github = req.app.get('github'); | ||
const username = req.query.username; | ||
|
||
var hostname = process.env.APP_URL || `${req.protocol}://${req.headers.host}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not used can be removed.
"not dead", | ||
"not ie <= 11", | ||
"not op_mini all" | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know about browserslist before, nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comes with react-scripts
😄
<a | ||
target="_blank" | ||
className="fb-xfbml-parse-ignore bg-blue-dark text-white rounded px-2 py-1 pointer text-white no-underline text-sm" | ||
href={`https://www.facebook.com/sharer/sharer.php?u=${window.location.origin}/username/${username}`} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we use the hostname in place of window.location.origin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of that? It's more difficult to use such a variable, and it isn't available to the frontend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency I guess 🤷♂️ it's no biggie. You'll have to excuse my lack of react knowledge here so apologies if this is a bad question, but we're using it here https://github.com/jenkoian/hacktoberfest-checker/pull/333/files#diff-af68e82a3010f5e2e3da304e5fe5caffR45 so could we not pass it through as a prop?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for passing it through as a prop, it's available everywhere through process.env.REACT_APP_HOSTNAME
. Will change it 😄
I pushed some spacing fixes which ESLint as well as my IDE were reporting. Generally, STUNNING WORK. I had started a react refactor as per #319 but got nowhere near as far as you have here. A few questions (mostly ESLint things) but this is really really close to merge. THANK YOU for submitting 😃 |
Some other food for thought, what about 2 spaces rather than 4? Seems to be the default for the vast majority of React apps, and with 4 spaces everything gets shifted to the right a lot, thereby making code (particularly JSX) more difficult to read. I think...:smile: |
@rafaelklaessen yeah thought you might pushback on that 😄 I tend to prefer 4 spaces as I struggle to see the indentation of just 2 😄 perhaps just me or my IDE though and you're right in JS world it does seem that 2 spaces is the norm. If you're happy to update (including .editorconfig and eslint stuff) then happy to go with 2. |
Moved from ESLint to Prettier because it's just so much more simple, and, opposed to ESLint, it just works(TM) with the latest babel presets. |
Thanks! Almost there. Could you update the 'Running the app' section of the README? If you could do the docker stuff that'd be great but no worries if not. |
Done! 😄 Start command is still the same, but it now uses (Didn't update the docker stuff - I'm not familiar with it.) |
@rafaelklaessen thanks! Gonna give it another look later before merge, but probably the greatest thing I've ever seen 👏 |
Hey sorry this is taking so long, need to find time to try this out with deployment but time is something in short supply for me right now. Hopefully soon! |
Sorry got no time at mo to run this myself but doing some reading https://facebook.github.io/create-react-app/docs/deployment#other-solutions seems like what we need? Are you able to try this out locally your end and if it works make the required updates? |
So you do want to combine the React and Express server? |
That seems the easiest thing for me...
… On 25 Oct 2018, at 21:57, Rafael Klaessen ***@***.***> wrote:
So you do want to combine the React and Express server?
I'm sure it will work...I've run create-react-app on Apache 😛
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@rafaelklaessen just to expand on that, it doesn't make sense to me to run the front end through a server as well as the back end, I mean it makes sense for development but not for production. I'm very very new to react though so perhaps it's just me 🤷♂️ |
Well, it isn't uncommon to have 2 servers. People use 2 servers to maintain separation of concerns, especially for larger apps. For hacktoberfest-checker, especially since frontend and backend are using the same configs, using one server indeed makes more sense. |
I've pushed a commit which works for me locally. Let me know if you're happy and i'll update the deployment scripts and merge! |
Fixed some tiny issues...There was a space missing in the footer, the build folder wasn't in Running both frontend and backend on one server works great 😄 |
Thanks realised it may be worth a note in the .env.example about the port being same on both when running in prod mode too
… On 27 Oct 2018, at 13:35, Rafael Klaessen ***@***.***> wrote:
Fixed some tiny issues...There was a space missing in the footer, the build folder wasn't in .gitignore and the static serving didn't use an arrow function.
Running both frontend and backend on one server works great.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I updated .env.example 😄 Let me know if you're OK with this phrasing. |
Merged! Thanks so much 👍 |
This is a refactor of the hacktoberfest-checker in React. The backend is now a very light API, separate from the frontend, which is a React app (managed by create-react-app).
The next step would be to figure out what the best way to run the frontend is...Maybe served by the backend, or ran on a different server. Shouldn't be difficult.
Run the frontend with
yarn start
and the backend withyarn server
.I look forward to your reply! I know this certainly isn't done but would love to eventually see it up and running on your server.
As per screenshot...Everything still looks exactly the same 😄