These are chat archives for FreeCodeCamp/Help

30th
Jan 2018
Ghost
@ghost~5a3ac208d73408ce4f843d6a
Jan 30 2018 00:01
what is this line.PNG
@thekholm80
slri
@slri
Jan 30 2018 00:04
@WebDevDeja you mean vertical? it's the wrap guide. you could have just googled it, the correct answer is the first search result for "vertical line atom"
Ghost
@ghost~5a3ac208d73408ce4f843d6a
Jan 30 2018 00:06
Oh, derp, I've googled everything else but that
Kyle Holm
@thekholm80
Jan 30 2018 00:06
@WebDevDeja click Edit => Preferences => Packages (scroll to bottom) => wrap-guide => disable
slri
@slri
Jan 30 2018 00:06
wrap guide so gooooooooooooooooood tho
hate it being displayed like that tho, yuck
Ghost
@ghost~5a3ac208d73408ce4f843d6a
Jan 30 2018 00:07
Why? I feel like it in my way but if there's a way I could use it to my advantage I'll keep it
Kyle Holm
@thekholm80
Jan 30 2018 00:08
my window isn't wide enough to show the wrap-guide lol
slri
@slri
Jan 30 2018 00:09
well some editors are hard to navigate when your lines go past your screen width, wrapping is really nice in those cases
then again my mouse should have horizontal scroll, i should set that up :c
Kyle Holm
@thekholm80
Jan 30 2018 00:10
image.png
slri
@slri
Jan 30 2018 00:10
aww yis this horizontal scroll feels so weird tho
Kyle Holm
@thekholm80
Jan 30 2018 00:10
love having ALL THE FILES open at the same time lol
slri
@slri
Jan 30 2018 00:10
hackerman split window
me
i do that so often, it's the same with tabs
in chrome i mean
Kyle Holm
@thekholm80
Jan 30 2018 00:11
yeah
slri
@slri
Jan 30 2018 00:11
i have like 50 open at a time when i'm researching and i only close anything when i start losing myself and duplicating the same tabs :x
Kyle Holm
@thekholm80
Jan 30 2018 00:11
it's a great feeling closing all the tabs though
slri
@slri
Jan 30 2018 00:12
oh yes
i take great pleasure in that too, i close them one by one on purpose cuz i feel like a god while doing it
Kyle Holm
@thekholm80
Jan 30 2018 00:12
haha yep
slri
@slri
Jan 30 2018 00:13
and then i open 50 new ones because i got another idea of what i could do
it's lonely doing all projects on your own tho
hmu if there are any lamps here (only organic ones pls)
Kyle Holm
@thekholm80
Jan 30 2018 00:14
mern or gtfo
:P
slri
@slri
Jan 30 2018 00:14
mean is a more popular stack tho (still) yikes
Kyle Holm
@thekholm80
Jan 30 2018 00:15
angular is not growing much anymore
slri
@slri
Jan 30 2018 00:15
tbh i wanna do something in angular
or react, i don't really care
Kyle Holm
@thekholm80
Jan 30 2018 00:15
I've never really tried angular
slri
@slri
Jan 30 2018 00:15
some front end framework i can go full out on
Kyle Holm
@thekholm80
Jan 30 2018 00:15
react is fun though
slri
@slri
Jan 30 2018 00:16
i learned some angular 1 and that was the end of it lmao
so kyle what kinda projects are you working on
Kyle Holm
@thekholm80
Jan 30 2018 00:16
umm
slri
@slri
Jan 30 2018 00:16
personal ones
Kyle Holm
@thekholm80
Jan 30 2018 00:16
arts & crafts
haven't really been writing much code lately
slri
@slri
Jan 30 2018 00:17
ohoh i've been binging on sculpting and doll repainting :x
Bjorn van de Peut
@bjorno43
Jan 30 2018 00:17
Some project I've been working on lately: https://www.icecub.nl/PairProgramming/#-L43Q43rRAx4lUyR8KzJ (top bar doesn't work yet)
slri
@slri
Jan 30 2018 00:17
videos, i can't do that stuff to save my life
Kyle Holm
@thekholm80
Jan 30 2018 00:17
I've been trying leather working, film making and photography
it's kind of boring
slri
@slri
Jan 30 2018 00:18
there's just one div .-.
oh i see
jesus
i was like "what the editor is basically empty what kind of a pair programming project is that" lmao
Bjorn van de Peut
@bjorno43
Jan 30 2018 00:19
Haha
slri
@slri
Jan 30 2018 00:20
is it real time? i wanted to implement real time editing as an option for my project too
but i'm working on a platform for ez website creation
Kyle Holm
@thekholm80
Jan 30 2018 00:21
I've used socket.io to make a chatroom - it was not fun
Bjorn van de Peut
@bjorno43
Jan 30 2018 00:21
Yup. Well, for as far as real time goes. There's always lag / delay depending on the users connection of course
Kyle Holm
@thekholm80
Jan 30 2018 00:21
i'm looking forward to trying graphql's subscribe functionality
slri
@slri
Jan 30 2018 00:21
yeah, you can't go against people's ping
how did you handle the inconsistency caused by lag when 2 users are editing the same line?
most people just apply literally no lock on the file, i think people should be able to mark their area and lock other people out of changing them
Bjorn van de Peut
@bjorno43
Jan 30 2018 00:23
I didn't. I've simply used https://firepad.io/ for this one. Made it quite easy. But I plan to create my own using OT.js (which pretty much every real time editor out there uses)
slri
@slri
Jan 30 2018 00:23
you need help? :33333333333333333333333333
Bjorn van de Peut
@bjorno43
Jan 30 2018 00:24
Probabely. The documentation on OT.js is terrible. Getting to understand it will be a pain :P
slri
@slri
Jan 30 2018 00:24
i'm interested O u O
hmu with the repo link if you want some dope amazeballs help with this one
Bjorn van de Peut
@bjorno43
Jan 30 2018 00:26
@RuinIsProbablyTaken Hmm. And here is actually an example project written by someone. Could be very usefull: https://github.com/YingshanDeng/SharedPen
Chris Cullen
@123xylem
Jan 30 2018 00:49

Chris Cullen @123xylem 10:49
Hi. I have this number from an api . 546798150000000000
But it should be 0.546798150000000000

Im trying to make it that number with the following code

var data = JSON.parse(body); //Data from the body

var balance =
Number(data["result"]/(Number(data["result"])*10)); // Make the data[result] The number and then do maths to it to add a 0. infront of it
Any idea how?

slri
@slri
Jan 30 2018 01:13
image.png
@bjorno43 where do the lies end, bob
i meant like your project's repo
i can google ot-related info myself xd
Kyle Holm
@thekholm80
Jan 30 2018 01:14
at least he didn't say it uses blockchain
slri
@slri
Jan 30 2018 01:16
tbh i'm used to no docs cuz i generally don't look at docs unless it's a huge library or it's something i can't take apart myself owo the source tells no lies
Bjorn van de Peut
@bjorno43
Jan 30 2018 01:32
@RuinIsProbablyTaken There's no repo on my project. You want the source of that one, right click it and view. There's not much there. As I said here: :point_up: 30 januari 2018 01:23 it's based on Firepad.
And yes. Firepad happens to use OT.js for Operational Transformation
Just as TogetherJS does. And Google Docs does. And pretty much every other collaboration editor out there does
Henry
@GitHub-Henry
Jan 30 2018 02:08

@123xylem here's a start of a solution

const apiNum = 546798150000000000;
//            0.546798150000000000
var apiStr = "0." + String(apiNum);
console.log(apiStr);
var newApiNum = Number(apiStr);
console.log(newApiNum);

now add the trailing zeros

Chris Cullen
@123xylem
Jan 30 2018 02:10
@GitHub-Henry thanks.. My question had a typo though as the number given wasnt .5 it was 55653...
Your solution does work unless the number its give is actually more than 1
CamperBot
@camperbot
Jan 30 2018 02:10
123xylem sends brownie points to @github-henry :sparkles: :thumbsup: :sparkles:
:cookie: 536 | @github-henry |http://www.freecodecamp.org/github-henry
swoonvin
@swoonvin
Jan 30 2018 02:22
@HeinousTugboat Thank you.
CamperBot
@camperbot
Jan 30 2018 02:22
swoonvin sends brownie points to @heinoustugboat :sparkles: :thumbsup: :sparkles:
:cookie: 330 | @heinoustugboat |http://www.freecodecamp.org/heinoustugboat
Alexander Jarman
@HeinousTugboat
Jan 30 2018 02:37
Man, I friggin' love Angular. <3 <3
Angular 2+.. not AngularJS..
Claudio Restifo
@Marmiz
Jan 30 2018 04:25

guys I was messing around with async/await, someone is willing to give me a hand?

Mainly in relation to error catching.
I am thinking of wrapping it in a try/catch scenario...
is there a better way?

Also where should I handle my "success"?
so If i have a structure like:

async  mainFunction() {
  try {
    const a = await apiCall() // this is a promise
    // should I handle success here? like doSomethingWith(a) ?
  } catch(e) {
    // do something with error
  }

  // or I should process the success outside the try/catch?
}

cheers :beer:

Alexander Jarman
@HeinousTugboat
Jan 30 2018 04:32
Wrapping async/await in try/catch is correct, I believe. :-)
let thing = somePromise()
    .then(x => doSomething(x))
    .catch(e => itBroke(e))
should be roughly the same as
try {
    let thing = await somePromise();
    doSomething(thing);
} catch(e) {
    itBroke(e);
}
yangxia605
@yangxia605
Jan 30 2018 04:35
image.png I am confused that why the last test not passed.I think I've already do it.
Alexander Jarman
@HeinousTugboat
Jan 30 2018 04:35
@yangxia605 I'm not super familiar with React or JSX, but it doesn't look like your submit handler's actually returning anything.
yangxia605
@yangxia605
Jan 30 2018 04:40
@HeinousTugboat submit handler changes the toDoList .that means push itemsArray into the toDoList.So that can be map into an ul element with some li inside of it.
Alexander Jarman
@HeinousTugboat
Jan 30 2018 04:40
Right, but if the test is looking for a return and is firing the handler by itself, it isn't going to see that change since it's looking for a return not a mutation.
I'm not sure how they mean "dynamically return" in this instance, though. I'll leave it to someone that knows the react curriculum better than I do.
What is it asking me to do exactly
i cant figure it out, looked into .assign
ive tryed most combination of this with/without status
return state.assign({}, state, action.type);
Manish Giri
@Manish-Giri
Jan 30 2018 07:06
return Object.assign({}, state, {/* your code here */ })
with Object.assign, you pass objects which contain the properties you want in your final object
Claudio Restifo
@Marmiz
Jan 30 2018 07:07
@ericmiller777 Object Assign
Manish Giri
@Manish-Giri
Jan 30 2018 07:07
@Marmiz :wave:
Claudio Restifo
@Marmiz
Jan 30 2018 07:07
@Manish-Giri :wavy_dash: all good?
Manish Giri
@Manish-Giri
Jan 30 2018 07:09
@Marmiz not really!
Claudio Restifo
@Marmiz
Jan 30 2018 07:09
That's a nice book.. I have a digital copy of it :)
Manish Giri
@Manish-Giri
Jan 30 2018 07:10
I don't read PDFs well so got a hold of this
Eric Miller
@ericmiller777
Jan 30 2018 07:11
@Manish-Giri @Marmiz thanks, ill keep trying
CamperBot
@camperbot
Jan 30 2018 07:11
ericmiller777 sends brownie points to @manish-giri and @marmiz :sparkles: :thumbsup: :sparkles:
:star2: 1138 | @marmiz |http://www.freecodecamp.org/marmiz
:star2: 6807 | @manish-giri |http://www.freecodecamp.org/manish-giri
Claudio Restifo
@Marmiz
Jan 30 2018 07:11
I think I have the digital from some humble bundle of some sort ^^
Manish Giri
@Manish-Giri
Jan 30 2018 07:13
I printed off YDKJS recently
Eric Miller
@ericmiller777
Jan 30 2018 07:13
@Manish-Giri i plan to read all of those soon
tm*
Manish Giri
@Manish-Giri
Jan 30 2018 07:13
cool
@Marmiz also need to finish this
Claudio Restifo
@Marmiz
Jan 30 2018 07:14

@ericmiller777 my 2c: instead of learning "to do stuff", learn a method "of learning".

For instance in this challenge they mention Object.assign.

If I've never heard of it --> look for official documentation about it.
I've heard but don't remember --> look on official docs
I'm not sure how it works --> open a repl and make some quick example to get an hang / visual aid.
finally try to implement the task

@Manish-Giri all I know about Java is some guy once told me is like C# but not really.
I think I've rated myself "confident in Java" on Linkedin :)
Manish Giri
@Manish-Giri
Jan 30 2018 07:16
lol
awesome
Eric Miller
@ericmiller777
Jan 30 2018 07:17
@Marmiz thanks, ive been trying to do that more, this one didnt seem to help much with twhat im trying to do (im sure its somthing simple i just need to understand it a bitt more)
CamperBot
@camperbot
Jan 30 2018 07:17
ericmiller777 sends brownie points to @marmiz :sparkles: :thumbsup: :sparkles:
api offline
Claudio Restifo
@Marmiz
Jan 30 2018 07:17
@ericmiller777 Docs and prototype.
Then you implement
Manish Giri
@Manish-Giri
Jan 30 2018 07:17
@ericmiller777 this example from the doc should help
var o1 = { a: 1, b: 1, c: 1 };
var o2 = { b: 2, c: 2 };
var o3 = { c: 3 };

var obj = Object.assign({}, o1, o2, o3);
console.log(obj); // { a: 1, b: 2, c: 3 }
Claudio Restifo
@Marmiz
Jan 30 2018 07:18
indeed!
Manish Giri
@Manish-Giri
Jan 30 2018 07:18
see how the values of b and c are being overwritten
that's your hint
Eric Miller
@ericmiller777
Jan 30 2018 07:18
thank you guys
Manish Giri
@Manish-Giri
Jan 30 2018 07:19
later on you'll use ... on objects too, then you won't need .assign() anymore
lol
Eric Miller
@ericmiller777
Jan 30 2018 07:20
yea spread operator I understood a lot more (but probably just because i could just then pass arrays ect to javascript functions i really understood)
Claudio Restifo
@Marmiz
Jan 30 2018 07:22
well if you like spread this is the equivalent of @Manish-Giri example:
var o1 = { a: 1, b: 1, c: 1 };
var o2 = { b: 2, c: 2 };
var o3 = { c: 3 };

var obj = Object.assign({}, {...o1, ...o2, ...o3});
console.log(obj); // { a: 1, b: 2, c: 3 }
but it's way more obscure imho
Manish Giri
@Manish-Giri
Jan 30 2018 07:23
you could just do var obj = ({}, {...o1, ...o2, ...o3})
should work the same
Manish Giri
@Manish-Giri
Jan 30 2018 07:31

@Marmiz loved this little advice from the book

A useful principle is not to add cleverness unless you are absolutely sure
you’re going to need it. It can be tempting to write general “frameworks”
for every little bit of functionality you come across. Resist that urge. You
won’t get any real work done, and you’ll end up writing a lot of code
that no one will ever use.

for everyone who writes 10 lines of JS and publishes a library, shit.js, crap.js, etc
Claudio Restifo
@Marmiz
Jan 30 2018 07:34

@Manish-Giri just found myself in the same rabbit hole the past week.

We are working on a massive react application atm, and we are gonna have a lots of different forms across the page.
So I decided to abstract the functionality away in a general fashion so that I can reuse the same idea across the app.

tuned out I went so deep that the code was hardly readable anymore.

Leave refactoring for when it's needed... that was my lesson
Manish Giri
@Manish-Giri
Jan 30 2018 07:35
:+1:
Claudio Restifo
@Marmiz
Jan 30 2018 07:36
still one of the best library as of today:
https://github.com/aemkei/jsfuck
this rise in the tops too:
https://github.com/hkbakke/bash-insulter
Manish Giri
@Manish-Giri
Jan 30 2018 07:41
lol
Eric Miller
@ericmiller777
Jan 30 2018 08:17
return Object.assign({}, state, {status: action.type});
I would think that would make that status overwrite the status in state
how can i log state?
Manish Giri
@Manish-Giri
Jan 30 2018 08:20
the status needs to be "online"
you don't need to modify state as such
Eric Miller
@ericmiller777
Jan 30 2018 08:24
lol
@Manish-Giri @Marmiz tahnks, its aggravating it took me so long to get it, but I guess i learned a bit about how it works....
Manish Giri
@Manish-Giri
Jan 30 2018 08:25
:+1:
keep at it
YUE HU
@hadeshy130
Jan 30 2018 09:06
just began the class and got stuck in setting the font-size. Where should I put the font-size command?
Sorin Ruse
@sorinr
Jan 30 2018 09:11
@hadeshy130 in the <style></style> section
YUE HU
@hadeshy130
Jan 30 2018 09:11
thanks!
Sorin Ruse
@sorinr
Jan 30 2018 09:12
:+1:
Eric Miller
@ericmiller777
Jan 30 2018 09:29
@Marmiz @Manish-Giri I was gonna link somthing in js(insert f word here), then noticed it was 30k chars lol
yangxia605
@yangxia605
Jan 30 2018 10:05
@HeinousTugboat anyhow thanks for your reply.I am also confused about ""dynamically return" ,so that not solve this problem at this time.
CamperBot
@camperbot
Jan 30 2018 10:05
yangxia605 sends brownie points to @heinoustugboat :sparkles: :thumbsup: :sparkles:
:cookie: 335 | @heinoustugboat |http://www.freecodecamp.org/heinoustugboat
Yossi Fisch
@yoizfefisch
Jan 30 2018 10:48
Trying to work on the Technical Documentation Page in the beta curriculum and I am not sure where to begin. Should I just copy the HTML from some technical website and style it myself?
seemotions
@seemotions
Jan 30 2018 10:57
Currently working on Build a Tribute Page how can i change space between rows
and what should I do if i want to make a text from a paragraph to be in 2 diffrent lines
Aditya
@ezioda004
Jan 30 2018 10:59
@seemotions To give space between two div you can use margin-top on the 2nd div
For the text to be in 2 different line you can use <br> tag
seemotions
@seemotions
Jan 30 2018 11:04
@ezioda004 Thanks dude!
CamperBot
@camperbot
Jan 30 2018 11:04
seemotions sends brownie points to @ezioda004 :sparkles: :thumbsup: :sparkles:
:cookie: 422 | @ezioda004 |http://www.freecodecamp.org/ezioda004
Yossi Fisch
@yoizfefisch
Jan 30 2018 11:57
@seemotions To change space between rows in the same paragraph, you can use the CSS line-height property.
seemotions
@seemotions
Jan 30 2018 12:48
one more think how to make every line start from the same position
slri
@slri
Jan 30 2018 13:54
@bjorno43 oh i see, thought you already had a repo for it, my bad
Bjorn van de Peut
@bjorno43
Jan 30 2018 13:56
@RuinIsProbablyTaken There's not much worthy of making a repo for. The source code you can see with the browser is all there is to it. Even a novice JS coder could do that, lol
ahmed-issa-mohd
@ahmed-issa-mohd
Jan 30 2018 13:57
can I have question , please?
Ken Haduch
@khaduch
Jan 30 2018 15:26
@ahmed-issa-mohd - do you want to ask a question? Post it here and everyone will try to help you.
Darren
@DarrenfJ
Jan 30 2018 15:56
morning fCC
@bjorno43 sorry brutha missed yer PM was offline last night.. will check it today
off to test and you know.. work
bah!
code on roomies!
Xavier Artot
@xavierartot
Jan 30 2018 18:04
Hi there
Darren
@DarrenfJ
Jan 30 2018 18:21
@xavierartot hi buddy! welcome to the helpRoom if you haven't already dropped by previously...
have a :coffee: on me ;)
Xavier Artot
@xavierartot
Jan 30 2018 18:42
thx
I cam last year and I back on FCC to finish the Visualisation
Darren
@DarrenfJ
Jan 30 2018 18:51
@xavierartot cool.. good luck on it and happy coding :D
LiteSoul
@LiteSoul
Jan 30 2018 19:44
Hi everyone... I'm wondering if the issue in the Beta FCC could be resolved: It was working fine until last week, now when you pass a test it stops there and you can't advance!
artbohr
@artbohr
Jan 30 2018 20:21
Does anyone have a good recommendation for a simple boilerplate which can be used for the dynamic projects (backend)?
Kyle Holm
@thekholm80
Jan 30 2018 20:23
@artbohr have you looked at clementine.js?
I think that's what FCC recommends
artbohr
@artbohr
Jan 30 2018 20:23
that's not useful for me, I think
I looked in to it
Kyle Holm
@thekholm80
Jan 30 2018 20:23
what are your requirements?
artbohr
@artbohr
Jan 30 2018 20:24
I mean't a kind of MERN boilerplate, with the minimum dependencies pack
Kyle Holm
@thekholm80
Jan 30 2018 20:25
I'd suggest making your own then - I assume you have node and npm installed? init a new project, install express, mongodb, react & all the stuff you normally use there then you can just clone it for each new project
artbohr
@artbohr
Jan 30 2018 20:25
ye, also thought that
but wanted to avoid webpack configurations for now, so I can proceed to the important stuff right away
Kyle Holm
@thekholm80
Jan 30 2018 20:26
use create-react-app for the front
artbohr
@artbohr
Jan 30 2018 20:26
but I guess the time I spent looking for boilerplate solutions, I could have learned all the important webpack stuff already
I tried mixing create-react-app with just an extra express install on it and a server.js file, but I failed to launch the node server.js, it's just stays on halt forever
Kyle Holm
@thekholm80
Jan 30 2018 20:27
the alpha webpack version is nearly zero config, I can't wait for it to make it live
but stumbled in to the problem I stated above

Step 6: Start the express server

node server.js

does nothing for me

Kyle Holm
@thekholm80
Jan 30 2018 20:30
hmm, i'll have to give that a try
artbohr
@artbohr
Jan 30 2018 20:32
will try it again now
maybe I did something wrong the last time
this combo seems pretty simple and convenient for me
Kyle Holm
@thekholm80
Jan 30 2018 20:33
i'm installing right now, i'll let you know how it turns out for me
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:33
@artbohr are have you done .listen on express server?
happysoccerboy
@happysoccerboy
Jan 30 2018 20:36
image.png
image.png
artbohr
@artbohr
Jan 30 2018 20:36
@SweetCodingInc after executing node server.js, it just stays on halt
happysoccerboy
@happysoccerboy
Jan 30 2018 20:37
i am working on the search and replace project, not sure why the replace doesn't work, can someone help provide guidance? thx
artbohr
@artbohr
Jan 30 2018 20:37
123.png
it stays like that
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:38
@artbohr yes
that's an expected behavior
you have this like
app.listen(process.env.PORT || 8080);
artbohr
@artbohr
Jan 30 2018 20:39
@SweetCodingInc ye
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:39
try doing
app.listen(process.env.PORT || 8080, () => {
  console.log('Server Started');
});
and see if you get that log
you have not specified the callback function for .listen so you don't get notified when the server is up
Kyle Holm
@thekholm80
Jan 30 2018 20:40
also, it looks like create-react-app outputs to public not build unless my install is old
other than that, it's all working for me
you'll have to enable CORS in development since your front end will run on port 3000 and your back end will be on port 8080
artbohr
@artbohr
Jan 30 2018 20:41
@SweetCodingInc damn, I'm retarded, thanks :D the server launches
CamperBot
@camperbot
Jan 30 2018 20:41
artbohr sends brownie points to @sweetcodinginc :sparkles: :thumbsup: :sparkles:
:cookie: 217 | @sweetcodinginc |http://www.freecodecamp.org/sweetcodinginc
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:42
@artbohr :+1:
artbohr
@artbohr
Jan 30 2018 20:42
@thekholm80 hmm, ye, the server works, just gotta configure them to behave with each other
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:42
@artbohr You won't need much configuration like @thekholm80
artbohr
@artbohr
Jan 30 2018 20:42
Error: ENOENT: no such file or directory, stat 'C:\Users\user\Desktop\example\test-app\build\index.html'
at Error (native)
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:42
just add a CORS middleware for express
artbohr
@artbohr
Jan 30 2018 20:43
gotta configute that
ok
Sweet Coding :)
@SweetCodingInc
Jan 30 2018 20:43
are you developing your backend as a REST server or does it serve your initial index.html file?
artbohr
@artbohr
Jan 30 2018 20:44
I'm doing the voting app project
so it has to have an api where I can send the requests as I understand it
Kyle Holm
@thekholm80
Jan 30 2018 20:45
you will build the api
in express
that's how your front end talks to your back end
artbohr
@artbohr
Jan 30 2018 20:46
yea, got a bit the grasp of that this past days, trying to figure out how to unite them
but I feel kinda lost and not fully understanding all the concepts
as I understand I will send requests to the backend API from the frontend API which will perform DB operations
Kyle Holm
@thekholm80
Jan 30 2018 20:47
right
artbohr
@artbohr
Jan 30 2018 20:47
not frontend API sorry
just frontend
Kyle Holm
@thekholm80
Jan 30 2018 20:48
user does something => front makes api call to back => back does magic => sends api results to front => page updates => user does something ... (repeat)
artbohr
@artbohr
Jan 30 2018 20:49
ye, now I gotta apply all this with the practice to get the real grasp of it
Kyle Holm
@thekholm80
Jan 30 2018 20:49
yep
just a suggestion, look at nodemon (npm install -g nodemon) it will let you hot-reload your server by running nodemon server.js instead of node server.js
it's pretty awesome
artbohr
@artbohr
Jan 30 2018 20:50
ye I know what nodemon is, will install it in a moment, thanks @thekholm80
CamperBot
@camperbot
Jan 30 2018 20:50
artbohr sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
:star2: 1679 | @thekholm80 |http://www.freecodecamp.org/thekholm80
artbohr
@artbohr
Jan 30 2018 20:52
btw, the CORS is because the backend and frontend runs in different ports, right?
Kyle Holm
@thekholm80
Jan 30 2018 20:52
yes
you can remove it in production
artbohr
@artbohr
Jan 30 2018 20:53
kinda confused with this last part thing from the tutorial

Conclusion

Now you can develop all you want on localhost:3000 by using npm run start and your API's will work as expected (despite requests coming from port 3000).

When you want to deploy, just run the production build npm run build and serve your app from localhost:8080, which is node server.js in this example (note the port number at the bottom of server.js).

you mean removing cors in production?
because the will unite?
they*
Kyle Holm
@thekholm80
Jan 30 2018 20:53
yes
you will serve the bundled version of your app in production from the public folder instead of running webpack
that's what the app.get('/', (req, res) => {}) bit in your server.js does
artbohr
@artbohr
Jan 30 2018 20:56
as I understood the "/" does handle requests to your root url, or am I missing something here?
Kyle Holm
@thekholm80
Jan 30 2018 20:56
yes, / is the main path
so if i were google, any request to http://google.com would come from that / path
artbohr
@artbohr
Jan 30 2018 20:57
ye
I feel pretty confused on what changes and how the deployment works, if I want to upload it to heroku for example
what changes from dev version to production version I mean, or bundle for deployment, or how that is called
Kyle Holm
@thekholm80
Jan 30 2018 20:58
when you get done building your front end you'll run npm build or something like that, it will bundle your front end up and put the output into the public folder
then when your server is running, any requests to your root path will serve that bundle
artbohr
@artbohr
Jan 30 2018 21:00
so the frontend does not run in a different port after is bundles, it just acts as an asset so to say which is rendered from the requests to the server
bundled*
Kyle Holm
@thekholm80
Jan 30 2018 21:00
correct
artbohr
@artbohr
Jan 30 2018 21:01
that's a good explanation thanks again, can't give brownies yet tho :worried: ^^
Kyle Holm
@thekholm80
Jan 30 2018 21:01
:smile: happy to help
artbohr
@artbohr
Jan 30 2018 21:04
still kinda confused about the heroku part once I'm done with the development
gone through their nodejs app tutorial deployment, but I guess this fullstack app will be quite different
found some tutorials, but can't understand the gist of how it works
Kyle Holm
@thekholm80
Jan 30 2018 21:07
it was the same for me as the microservices
I just didn't push my react dev files to heroku when it came time to deploy
if you do the same, remember that any assets you need in production should be in the public directory
Darren
@DarrenfJ
Jan 30 2018 21:10
@artbohr I'll give him brownie points ;)
thanks @thekholm80 my bearded brutha for your tireless helping of the out
CamperBot
@camperbot
Jan 30 2018 21:10
:star2: 1680 | @thekholm80 |http://www.freecodecamp.org/thekholm80
darrenfj sends brownie points to @thekholm80 :sparkles: :thumbsup: :sparkles:
Garrus Napp
@GarrusNapp
Jan 30 2018 21:10
@DarrenfJ just dont get banned ; )
Darren
@DarrenfJ
Jan 30 2018 21:10
i'm allowed on thank you per page scroll ;)
or 15 minutes :P
Kyle Holm
@thekholm80
Jan 30 2018 21:11
@DarrenfJ hey thanks man! happy to hold the fort down while you're working for the man
CamperBot
@camperbot
Jan 30 2018 21:11
thekholm80 sends brownie points to @darrenfj :sparkles: :thumbsup: :sparkles:
:star2: 2367 | @darrenfj |http://www.freecodecamp.org/darrenfj
Manish Giri
@Manish-Giri
Jan 30 2018 21:14
@DarrenfJ @GarrusNapp @thekholm80 :wave:
Garrus Napp
@GarrusNapp
Jan 30 2018 21:15
@Manish-Giri yoyo
Kyle Holm
@thekholm80
Jan 30 2018 21:15
@Manish-Giri hola che
Manish Giri
@Manish-Giri
Jan 30 2018 21:15
@GarrusNapp still alive and kicking I see!
I was thinking you or me would get banned pretty soon (considering how things were)
lol
Garrus Napp
@GarrusNapp
Jan 30 2018 21:16
well :D
im still alive, only react can kill me now
and it slowly starts to
Manish Giri
@Manish-Giri
Jan 30 2018 21:16
in my case, it's angular
and servlets
and spring
Garrus Napp
@GarrusNapp
Jan 30 2018 21:18
i'm at the point where if I just try to sit and code without planning it before, I'll mess up for sure :D
it's not jQuery anymore :D
Kyle Holm
@thekholm80
Jan 30 2018 21:18
lol
Manish Giri
@Manish-Giri
Jan 30 2018 21:18
I miss jQuery
Kyle Holm
@thekholm80
Jan 30 2018 21:19
i love writing react code, but i hate the react ecosystem
webpack, babel, etc ... such a pain
Manish Giri
@Manish-Giri
Jan 30 2018 21:19
you should switch to angular
and then teach me
Kyle Holm
@thekholm80
Jan 30 2018 21:19
angular 1?
deal
Manish Giri
@Manish-Giri
Jan 30 2018 21:19
2
4
5
Kyle Holm
@thekholm80
Jan 30 2018 21:19
nope, 1 or nothing
Garrus Napp
@GarrusNapp
Jan 30 2018 21:19
I'm just using create-react-app idgaf xD
Manish Giri
@Manish-Giri
Jan 30 2018 21:19
1 is easy
Kyle Holm
@thekholm80
Jan 30 2018 21:20
create-react-app had way too much stuff i didn't need
Manish Giri
@Manish-Giri
Jan 30 2018 21:20
I had to install yarn yest
just coz create-react-app ditched npm
Garrus Napp
@GarrusNapp
Jan 30 2018 21:20
did they?
Manish Giri
@Manish-Giri
Jan 30 2018 21:20
yup
Garrus Napp
@GarrusNapp
Jan 30 2018 21:20
ffs
IF YOURE NOT RUNNING YOURE GOING BACKWARDS
Manish Giri
@Manish-Giri
Jan 30 2018 21:21
speaking of running, I should prolly go to the gym
Garrus Napp
@GarrusNapp
Jan 30 2018 21:21
lift them weights
Manish Giri
@Manish-Giri
Jan 30 2018 21:21
sitting and coding won't do you any good in real life
if u kno what I mean
Kyle Holm
@thekholm80
Jan 30 2018 21:22
there are hot singles in my area who want to meet me, I don't need the gym
Garrus Napp
@GarrusNapp
Jan 30 2018 21:22
well, it makes your wallet bigger in a long run
@Manish-Giri you lift or just run?
Manish Giri
@Manish-Giri
Jan 30 2018 21:24
atm I run
will go back to lifting in a month
Garrus Napp
@GarrusNapp
Jan 30 2018 21:25
i started 'stronglifts 5x5 ' recently
Manish Giri
@Manish-Giri
Jan 30 2018 21:25
cool
Garrus Napp
@GarrusNapp
Jan 30 2018 21:25
good stuff but linear progression is going to kill me
Manish Giri
@Manish-Giri
Jan 30 2018 21:27
what doesn't kill you only makes you stronger
Garrus Napp
@GarrusNapp
Jan 30 2018 21:28
or it'll just send me back to procastrination mode
when you struggle but make it, it feels good. but then you remember that next time you have to lift more
LiteSoul
@LiteSoul
Jan 30 2018 21:28
I just add weights every other week instead of every week, regarding 5x5
Garrus Napp
@GarrusNapp
Jan 30 2018 21:31
the one I use increases by 2.5kg each training
starting from just bar tho
LiteSoul
@LiteSoul
Jan 30 2018 21:34
yeah but I couldn't keep adding that much after a while
Garrus Napp
@GarrusNapp
Jan 30 2018 21:36
Yea I think you're bound to plateau after a certain point but for now I lift baby weights so I'm good
Darren
@DarrenfJ
Jan 30 2018 21:42
@thekholm80 i am most definitely a cog in theeee man's wheels
@Manish-Giri buddy! :wave:
Darren
@DarrenfJ
Jan 30 2018 21:49
also, not that any of you guys need it.. but anyone new who wants to practice git/github: https://forum.freecodecamp.org/t/git-and-github-practice-for-all-us-noobies/171808
feel free to share
DarrenfJ @DarrenfJ sneaks back under his bridge to whip up some unsolvable puzzles for weary travelers
Stephen James
@sjames1958gm
Jan 30 2018 23:10
@DarrenfJ I knew you were a bridge troll!
CamperBot
@camperbot
Jan 30 2018 23:10
:trollface: troll problems? notify admins here