These are chat archives for FreeCodeCamp/Help

4th
Nov 2018
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:11
@diomed what is that in the image
Christopher McCormack
@cmccormack
Nov 04 2018 01:21
@Nirajn2311 it's a metallic cylinder or course
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:22
Yesh im sure everyone can see that
but why the special box for it
Christopher McCormack
@cmccormack
Nov 04 2018 01:29
@Nirajn2311 you don't just use any old box for a cylinder that nice
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:30
Ah i see, you like those curvvvves
Christopher McCormack
@cmccormack
Nov 04 2018 01:31
@Nirajn2311 oh yeah
I think it's the definition of a Kilogram
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:32
@cmccormack hows the jamstack going
Christopher McCormack
@cmccormack
Nov 04 2018 01:32
@Nirajn2311 seems fine, I've been in and out listening to the interviews
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:32
People seem to be problems in the noise
Christopher McCormack
@cmccormack
Nov 04 2018 01:32
no idea what they are building though
yeah they complain a lot for very minor audio issues
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:35
You saw the new ipad pro
Christopher McCormack
@cmccormack
Nov 04 2018 01:37
just heard a few things about it
or is that a prize?
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:39
I dont know what the prices are but making the ipad almost like a laptop, maybe apple starting thinking
Christopher McCormack
@cmccormack
Nov 04 2018 01:44
Maybe, I just hope they don't go the other way and make their laptops like their tablets :)
I used to love tablets but with larger phones lately I haven't had much need for one
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:45
I dont see the sense in making a phone bigger
a bigger phone, a bigger chance of phone falling
How is macbook pro
Christopher McCormack
@cmccormack
Nov 04 2018 01:53
I love my 2015
I don't like the newer ones though, I have one for work and I very much dislike the shorter travel on the keys, and the touchbar is worthless other than the fingerprint reader
I have a pixel xl 2 with a case, big phone and I do drop occasionally but that's what the case is for :)
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:54
Pixel 3 is out, i might buy it next year
Christopher McCormack
@cmccormack
Nov 04 2018 01:55
I might get it now, I can get it half off if I trade in my current phone
the cameras on these things are amazing
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:55
Thats the main reason i like the pixel
Christopher McCormack
@cmccormack
Nov 04 2018 01:56
they are great phones i've been pretty happy with them
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:57
So where do you live
usa or somewhere else
Christopher McCormack
@cmccormack
Nov 04 2018 01:57
US - Arizona
you?
Dubai?
Niraj Nandish
@Nirajn2311
Nov 04 2018 01:59
Yeah, dubai
Is arizona always hot or does it snow over there
Christopher McCormack
@cmccormack
Nov 04 2018 02:01
I live up in Flagstaff in the mountains, it's about 2km above Phoenix. It snows up here in the winter
already has even
Is it rainy up there right now? I remember in Kuwait/Iraq it was so damned rainy in the winter
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:02
Any good computer science or software engineering unis in arizona
It rained in bahrain
but here its a different case, it rained in some random places like spots of cloud here and there
Christopher McCormack
@cmccormack
Nov 04 2018 02:03
@Nirajn2311 dunno, I went to Arizona State and thought the CS courses were good but I can't vouch for the overall quality compared to other schools
@Nirajn2311 it's hotter out there in the summer than Arizona isn't it? man I can't imagine haha
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:04
Heck, it burns here 🔥🔥
Christopher McCormack
@cmccormack
Nov 04 2018 02:04
44C in the summer is plenty for me not to want to go outside
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:04
you can make an omlette on your vehicle
Christopher McCormack
@cmccormack
Nov 04 2018 02:05
haha please record it
How is the CS scene out there?
or the tech scene in general
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:06
With the expo 2020, it is increasing exponentially
Christopher McCormack
@cmccormack
Nov 04 2018 02:07
what is that?
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:08
just two weeks ago, all government centers were intentionally closed for one week and all citizens had to use the apps to get services
Christopher McCormack
@cmccormack
Nov 04 2018 02:08
oh wow
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:08
dubai is making huge strides regarding the tech side
Christopher McCormack
@cmccormack
Nov 04 2018 02:08
just to see their capabilities?
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:08
Yeah
Christopher McCormack
@cmccormack
Nov 04 2018 02:08
Good I hope they can rub it in the faces of the US luddites
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:09
I hope they rub it on Trump
Christopher McCormack
@cmccormack
Nov 04 2018 02:10
:D
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:11
Expo is like an event
Christopher McCormack
@cmccormack
Nov 04 2018 02:12
I love how there is a countdown 102 weeks ...
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:12
Where most countries come and show something
its like an international world fair
I love how there is a countdown 102 weeks ...
they recently did a celebration for two years left
Christopher McCormack
@cmccormack
Nov 04 2018 02:13
I wonder if I can get tickets cheaper if I do so two years in advanced? haha
How do you celebrate something like that?
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:15
By keeping some events
and countdown event like new years on burj khalifa
Do we accept w3 links
Christopher McCormack
@cmccormack
Nov 04 2018 02:17
I don't think we do
if they are just adding links it can be rejected anyway
if they add content and a w3 schools link you can remove the link in a commit if you want
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:19
I wonder if I can get tickets cheaper if I do so two years in advanced?
maybe if you are lucky
Christopher McCormack
@cmccormack
Nov 04 2018 02:20
hard to get or hard to get a discount? lol
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:20
They havent opened, so you never know
Anand Potukuchi
@anandpotukchi
Nov 04 2018 02:21
@Nirajn2311 don't know how "good"but there's Arizona State.. research that one out
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:23
Hey @anandpotukchi hows it going
attending jamstack??
Christopher McCormack
@cmccormack
Nov 04 2018 02:23
Arizona State gets made fun of because it's considered a party school (I think there are some 80,000 students attending) but they also have some pretty good schools and professors
Anand Potukuchi
@anandpotukchi
Nov 04 2018 02:26
@Nirajn2311 I was late just like Chris
You don't mind me calling you Chris right @cmccormack ?
Christopher McCormack
@cmccormack
Nov 04 2018 02:27
nope it's my name
Both ways are fine
Ralph Nahra
@Rallph
Nov 04 2018 02:35
just curious, is there an FCC general chat? I'm pretty sure there used to be one but I can't sem to find it now
Anand Potukuchi
@anandpotukchi
Nov 04 2018 02:36
@Rallph they removed it when they revamped the curriculum
So we're left with this
Christopher McCormack
@cmccormack
Nov 04 2018 02:37
It had more to do with the type of conversation happening in there I believe
Ralph Nahra
@Rallph
Nov 04 2018 02:38
Well that's kinda unfortunate. I was hoping to be able to engage in some random conversation
Niraj Nandish
@Nirajn2311
Nov 04 2018 02:39
You can do that here
Ralph Nahra
@Rallph
Nov 04 2018 02:41
Ok, well hello everybody. How's everyone doing?
Anand Potukuchi
@anandpotukchi
Nov 04 2018 02:41
Good
Luc Martin
@fmartin5
Nov 04 2018 02:41
Hello
Anand Potukuchi
@anandpotukchi
Nov 04 2018 02:41
Just completed my morning jog
@fmartin5 Hello
Luc Martin
@fmartin5
Nov 04 2018 02:41
Trying to debug some crazy JS
Ralph Nahra
@Rallph
Nov 04 2018 02:42
@fmartin5 how crazy?
Anand Potukuchi
@anandpotukchi
Nov 04 2018 02:42
Yeah how crazy @fmartin5
Luc Martin
@fmartin5
Nov 04 2018 02:42
It's an interface to use the Python repl from Node ^^
Ralph Nahra
@Rallph
Nov 04 2018 02:43
that does sound like it could get kinda crazy
Christopher McCormack
@cmccormack
Nov 04 2018 02:43
python-shell?
Luc Martin
@fmartin5
Nov 04 2018 02:43
Yeah
No it's my own
However if python-shell does thesame I'm going to have a look :) Thank you
Christopher McCormack
@cmccormack
Nov 04 2018 02:45
it's just a wrapper for child_process I think
Luc Martin
@fmartin5
Nov 04 2018 02:46
Oh
Christopher McCormack
@cmccormack
Nov 04 2018 02:46
but it seems to work ok
My wife was playing with it recently to make an electron app with a flask backend
Luc Martin
@fmartin5
Nov 04 2018 02:46
Mine is a wrapper around the python repl
Because sometimes I'm too lazy to open two terminal windows
Christopher McCormack
@cmccormack
Nov 04 2018 02:49
why not just use node?
Luc Martin
@fmartin5
Nov 04 2018 02:49
I'm using it
Christopher McCormack
@cmccormack
Nov 04 2018 02:49
node repl
Luc Martin
@fmartin5
Nov 04 2018 02:50
It's just to be able to run python code from node's repl and see the results
I guess it's not terribly useful ^^
Christopher McCormack
@cmccormack
Nov 04 2018 02:51
.exit
python
:)
Luc Martin
@fmartin5
Nov 04 2018 02:51
xD
Christopher McCormack
@cmccormack
Nov 04 2018 02:51
but why would you want Python's repl over node, anything in particular?
or vice versa
Luc Martin
@fmartin5
Nov 04 2018 02:52
it's to have both in the same window
Sometimes python has nice libraries
Christopher McCormack
@cmccormack
Nov 04 2018 02:53
keep a Jupyter notebook open maybe?
Luc Martin
@fmartin5
Nov 04 2018 02:53
Hmm maybe
I didn't try that
Christopher McCormack
@cmccormack
Nov 04 2018 02:54
love jupyter
Luc Martin
@fmartin5
Nov 04 2018 02:54
:)
Ralph Nahra
@Rallph
Nov 04 2018 03:06
I'm just chilling. Learning react while listening to some Avicii
Christopher McCormack
@cmccormack
Nov 04 2018 03:14
@Rallph enjoying React? How far in are you?
Luc Martin
@fmartin5
Nov 04 2018 03:14
Oops I just learned that calling process.stdout.resume(); can freeze the Node repl
Ralph Nahra
@Rallph
Nov 04 2018 03:18
@cmccormack I'm enjoying it a lot! I went through the whole FCC section on it, and now I'm going through another resource just to reinforce my grasp on it.
It made me wonder why things weren't done like this from the beginning, but then I remembered that the web now is very different from when it started
Christopher McCormack
@cmccormack
Nov 04 2018 03:21
it definitely is interesting. I really enjoy it, was playing with the new hooks api today
Ralph Nahra
@Rallph
Nov 04 2018 03:21
@cmccormack what's that?
Christopher McCormack
@cmccormack
Nov 04 2018 03:21
functions that allow you to use state and class component-like functions within functional components
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:22
I came, i saw react and i was like nah, some other time when i have more time to learn it
Instead started vue
🖖🖖
Christopher McCormack
@cmccormack
Nov 04 2018 03:23
An example of useState https://codesandbox.io/s/xp9mpy94n4
@Nirajn2311 you should try it sometime :)
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:24
I did try it, but then i realised that i would need more free time to understand it and makes some things with it
So i stopped and pushed it to april next year
As by then ill be done with school for life 🤘🤘
Christopher McCormack
@cmccormack
Nov 04 2018 03:26
haha that's what you think
I'm 35 and still learning everyday, only way to stay competitive :)
but you don't seem like someone that will stop learning
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:27
Thats why im learning vue in its place
Ralph Nahra
@Rallph
Nov 04 2018 03:27
@cmccormack huh, that's pretty cool. Also I wasn't aware of codesandbox's existence and it also seems cool
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:27
And then react
after react, it is angular and ts
but you don't seem like someone that will stop learning
i get bored if i dont find a challenge
or something interesting
Ralph Nahra
@Rallph
Nov 04 2018 03:28
@Nirajn2311 what's your experience with vue been like? I was about to start learning but, but opted for react instead
Christopher McCormack
@cmccormack
Nov 04 2018 03:28
just don't forget to enjoy life a bit too
I'm using pug and vanilla JS for my current project and just wish I could go back to React :(
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:29
well vue has turned out to be easy but that must be because ive not yet gone to deep end of it
just don't forget to enjoy life a bit too
almost getting caught by police for vandalism
Now that was enjoyment
Who doesnt enjoy life
Christopher McCormack
@cmccormack
Nov 04 2018 03:31
haha
Ralph Nahra
@Rallph
Nov 04 2018 03:32
hahaha
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:32
Bye, have to have breakfast
Ralph Nahra
@Rallph
Nov 04 2018 03:32
see ya later
Niraj Nandish
@Nirajn2311
Nov 04 2018 03:33
@cmccormack those netlify people, did they make the sudoku app all while livestreaming
Christopher McCormack
@cmccormack
Nov 04 2018 03:34
@Nirajn2311 I didn't see it but I did hear a guy keep talking about his first app being a sudoku solver
maybe that's why lol
see ya
wtywutengyue
@wtywutengyue
Nov 04 2018 05:45
what is paragraph
outbymine
@outbymine
Nov 04 2018 05:46
paragraph is a
Complete instruction
why don't you google it?
wtywutengyue
@wtywutengyue
Nov 04 2018 05:49
Add a Paragraph below the subtitle: Hello Paragraph.
What should i do
outbymine
@outbymine
Nov 04 2018 05:52
<p>your paragraph</p>
it is
wtywutengyue
@wtywutengyue
Nov 04 2018 05:53
thank you
outbymine
@outbymine
Nov 04 2018 05:53
You are welcom
glitz20
@glitz20
Nov 04 2018 06:07
anybody who knows how to have forms with multiple line in react?

Currently I have this

<input name='title' type="text" onChange={this.handleChange} className="form-control"/>

It only allows one line

Aditya
@ezioda004
Nov 04 2018 06:34
<textarea>
andrea
@girlcodecrush
Nov 04 2018 08:44
hi. I’m trying to code that gets only the APIs starting with “https://news.naver.com/“. When I checked out my code on Postman regarding a GET request, it says “Couldn’t get any response”. would be great what goes wrong with my code. Here’s my code:

request(options, (error, response, body) => {
for (var i = 0; i < body.items.length; i++) {
var naverNews = body.items.filter(function (item) {
if (body.items[i].link === 'https://news.naver.com/') {
return body.items[i].link;
}
});
return naverNews;
}

if (!error && response.statusCode === 200) {
  console.log(
    'neverNews router listening on port 3000'
    //  'http://127.0.0.1:3000/search/news?query=검색어 router listening on port 3000!'
  );
  res.set({ 'content-type': 'application/json; charset=utf-8' }); // should set utf-8 in request!!
  res.end(body);
} else {
  res.status(response.statusCode).end();
  console.log('error = ' + response.statusCode);
}

});

please have a look at the first part that .fiter() method is used to filter out the links that match “https://news.nave.com/“.
request(options, (error, response, body) => {
for (var i = 0; i < body.items.length; i++) {
var naverNews = body.items.filter(function (item) {
if (body.items[i].link === 'https://news.naver.com/') {
return body.items[i].link;
}
});
return naverNews;
}
Oops! there’s a typo: .filter() method of array
Aditya
@ezioda004
Nov 04 2018 08:51
@girlcodecrush Is the .filter() method isnt working? Seems fine tho, on side note you could do item.link === 'https://news.naver.com/' since item is the currently iterated element.
andrea
@girlcodecrush
Nov 04 2018 08:56
Hi.Aidtya. The data type goes like this: body(the last argument of request) is an object, inside body,
{ items: [
{  title:   
      Link:
        Pubdate:
},
{title:        ,
Link: ,
Subdata:
}, …...
]
}
So items is sort of the name of the entire array, and array contains mutiple objects within.
andrea
@girlcodecrush
Nov 04 2018 09:02
sorry. body is the last parameter of request.
correction again. it is the last parameter of a callback function.
phao5814
@phao5814
Nov 04 2018 09:51
Hi everyone, would appreciate if someone with firebase / webpack experience could help me out here. https://stackoverflow.com/questions/53139432/importing-only-auth-package-from-firebase-module
CoderOO7
@CoderOO7
Nov 04 2018 10:45
Hi I want to know what is the difference between the console we used online and console we used in our browser to write Code?
Ene Catalin
@EneCatalin
Nov 04 2018 11:07
I am not good enough at this to be sure about it but in the local console you have admin privileges
in the one they give you you have whatever capacity they programmed into it
or are you referring to the FCC js/html etc interpreter ?
I think that's all written in js and should be nothing like your actual console
anyway gtg
Luc Martin
@fmartin5
Nov 04 2018 14:03
@girlcodecrush Isn't body.items a NodeList instead of an array? A DOM NodeList has no .filter()method
Bashaar (Bas)
@Chiefbas
Nov 04 2018 14:05

@AlexPotor

<h2>CatPhotoApp</h2>

<main> (The main element needed to be before the p elentent and closed ofcourse downstairs" The main is a element that helps them search all the content quicker in your page.
<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p> (You needed to make a second P element)

</main>

My explaination might be a bit vage but i'm also a beginner haha
AlexPotor
@AlexPotor
Nov 04 2018 14:06
@Chiefbas just got it - thx it was too easy
Bashaar (Bas)
@Chiefbas
Nov 04 2018 14:07
:)
AlexPotor
@AlexPotor
Nov 04 2018 14:07
@Chiefbas the video is a bit wrong I would say ;)
Bashaar (Bas)
@Chiefbas
Nov 04 2018 14:10
@AlexPotor Oh i don't use the video haha. Just read the text and try it until i find the solution
Luc Martin
@fmartin5
Nov 04 2018 14:17
@girlcodecrush But in that case you can still call `[].filter.call(body.items, function (item) { / ... / })
Sorry if I'm wrong and the http lib you're using actually returns plain arrays
Anyway I think you can simplify the filter function like this:
function (item) {
    return item.link === 'https://news.naver.com/';
}
Maybe also a problem with the trailing slash
Luc Martin
@fmartin5
Nov 04 2018 14:24
You were using the ifrom the outer scope to re-access body.items[i] but the function you passed to filter already gets item as argument
Hmm actually it might be not necessary to iterate over the items at all
If you just want to get the matching items as an array
Using the filter method should be enough
Luc Martin
@fmartin5
Nov 04 2018 14:32
request(options, (error, response, body) => {
    var naverNews = body.items.filter(function (item) {
        return item.link === 'https://news.naver.com/';
    });
    return naverNews;
}
Now I don't know Postman but usually, returning from a callback does nothing.
You might want to use the produced naverNews by passing it to some other function instead of returning it
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:22
can someone explain this express line:
app.set('views', path.join(__dirname, 'views'))
Christopher McCormack
@cmccormack
Nov 04 2018 20:23
@fullstackinprogress_gitlab that tells express where the template files reside when using render
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:23
@cmccormack thanks can you maybe explain more about template files ?
Christopher McCormack
@cmccormack
Nov 04 2018 20:24
@fullstackinprogress_gitlab this may be a good start https://expressjs.com/en/guide/using-template-engines.html
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:24
@cmccormack thanks :)
Christopher McCormack
@cmccormack
Nov 04 2018 20:25
Basically you have a template engine that parses template files, express can be configured to select which engine to use for render. So if you set pug as your engine and views as your location for those files, res.render('index', ...) will render index.pug from views with whatever values you pass in the second argument
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:27
@cmccormack thanks :) can you also maybe go in depth about this part
path.join(__dirname, 'views')
Christopher McCormack
@cmccormack
Nov 04 2018 20:28
@fullstackinprogress_gitlab dirname is a special variable that you have access to, it's basically the full path of the directory in which your js file was loaded
you can console log it to see what it contains
path.join is a safer way to combine __dirname with views
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:29
and "views" is a template page ? from a template engine
Christopher McCormack
@cmccormack
Nov 04 2018 20:29
so if __dirname is something like /var/www/mysite/ or whatever, path.join(__dirname, 'views') would return /var/www/mysite/views
views is a directory
you would put your template files in there, like index.pug for example
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:31
@cmccormack thanks a lot its a lot more clear now !! great help :)
Christopher McCormack
@cmccormack
Nov 04 2018 20:31
np definitely read up on it, once you get it down it's really easy to get a backend project up and running quickly
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:32
@cmccormack thanks a lot :)
Christopher McCormack
@cmccormack
Nov 04 2018 20:33
np
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:36
@cmccormack and this piece of code will set which template engine i use in that directory ?
app.set('view engine', 'ejs')
Christopher McCormack
@cmccormack
Nov 04 2018 20:36
yeah pretty much
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:37
@cmccormack thanks again
Christopher McCormack
@cmccormack
Nov 04 2018 20:37
ejs will still need to be installed as a dependency though (I think)
yeah npm install -S ejs
I think the string 'ejs' in the app.set above is a helper express provides so you don't actually have to import ejs
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:38
i think so to because i dont see it in teh required modules im working on a form example amde with expres and node
and now figuring out how it works and what the code does
line for line
Christopher McCormack
@cmccormack
Nov 04 2018 20:40
you should still have to install it as a dependency, just not import it into your server
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:41
is it not included in express
Christopher McCormack
@cmccormack
Nov 04 2018 20:41
your package.json should have ejs listed in the dependencies property right?
I don't think so but don't take my word for it
they usually try to separate stuff like that lately
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:42
yes its in the package.json thanks for the tip else i was thinking it was and included express module
nice :)
but why its not needed to require ejs ?
Christopher McCormack
@cmccormack
Nov 04 2018 20:43
i'm not exactly certain, express must have a helper to do it
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:43
okaay nice maybe to be save always require anyways ?
Christopher McCormack
@cmccormack
Nov 04 2018 20:44
I don't know, I"ve never tried to require the template engine and use that before but you could try it yourself!
actually I'm using pug right now I can try real quick
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:44
thanks ! :)
Christopher McCormack
@cmccormack
Nov 04 2018 20:46
didn't work for me just requiring it and using it, it expects a string
After the view engine is set, you don’t have to specify the engine or load the template engine module in your app; Express loads the module internally
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:47
app.set('view engine', 'ejs') will also do the require task ?
Christopher McCormack
@cmccormack
Nov 04 2018 20:47
apparently :)
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:47
because in the file its not required and the code works fine so i think it has to do with the app.set
thanks bro for helping me out on this one
:)
Christopher McCormack
@cmccormack
Nov 04 2018 20:49
no problem
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:50
can you maybe also explain what this line of code does
  express.static(path.join(__dirname, 'public')),
Christopher McCormack
@cmccormack
Nov 04 2018 20:54
yup think of that like a little webserver
so when your index.html is rendered and sent to the frontend, that file may have references to CSS/JS files right?
need to serve them somehow
and making endpoints for every file would be super tedious
so put them in a public directory, use the static server, and done
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 20:55
@cmccormack nice also clear !!! great help
Christopher McCormack
@cmccormack
Nov 04 2018 20:55
np
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 21:01
@cmccormack there is only one thing not so clear to me :
const layout = require('express-layout')
what is the purpose of teh express-layout module
Christopher McCormack
@cmccormack
Nov 04 2018 21:02
I've not used that one but you can check out the npm doc and maybe the github page https://www.npmjs.com/package/express-layout
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 21:03
yes i readed the page but still not very clear
Christopher McCormack
@cmccormack
Nov 04 2018 21:03
I agree
:)
doesn't look like the github repo even exists anymore
I gotta run for a few, hope you got your answers!
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 21:05
@cmccormack maybe is that module the reason why i dont have to include ejs because it has a example with jade
thanks bro :)
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 21:14
@cmccormack i see that i need both to let the css in the public directory work
const middlewares = [
  layout(),
  express.static(path.join(__dirname, 'public'))
]
if i comment out one the css will not work anymore
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 21:24
@cmccormack this module does the same :
https://www.npmjs.com/package/express-ejs-layouts
but still dont know what it really is and does
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 21:40
can someone help me ?
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 22:06
@cmccormack ?
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 22:36
can someone explain me this module https://www.npmjs.com/package/express-ejs-layouts
dyon gerwen
@fullstackinprogress_gitlab
Nov 04 2018 23:12
can someone explain me this node js express module :
https://www.npmjs.com/package/express-ejs-layouts
what is does and where and when it is used