Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Jun 19 12:31
    @texas2010 banned @therichaverma
  • Jun 19 2020 20:05
    @krisb1220 banned @Gastony
  • May 14 2020 22:39
    @bjorno43 banned @minitechtips_twitter
  • May 14 2020 22:38
    @bjorno43 banned @real-action
  • Feb 01 2020 00:26
    @bjorno43 banned @Ndoua
  • Jan 07 2020 03:10
    @bjorno43 banned @doctor-sam
  • Aug 17 2019 09:32
    User @bjorno43 unbanned @linkin-park
  • Aug 17 2019 01:43
    @bjorno43 banned @linkin-park
  • Jun 20 2019 21:20
    @bjorno43 banned @shenerd140
  • May 10 2019 09:13
    @bjorno43 banned @zhaokunhaoa
  • Apr 27 2019 19:47
    @mstellaluna banned @zhonghuacx
  • Apr 25 2019 17:12
    @mstellaluna banned @cmal
  • Jan 08 2019 22:00
    @mstellaluna banned @dertiuss323
  • Dec 15 2018 23:36
    @mstellaluna banned @18835579411
  • Dec 13 2018 23:57
    @mstellaluna banned @brandon6190
  • Oct 12 2018 05:50
    @bjorno43 banned @NACH74
  • Oct 05 2018 23:02
    @mstellaluna banned @JomoPipi
  • Sep 16 2018 12:21
    @bjorno43 banned @yash-kedia
  • Sep 16 2018 12:16
    @bjorno43 banned @vnikifirov
  • Sep 05 2018 08:13
    User @bjorno43 unbanned @androuino
Jess Johnson
Code I have
app.post('/', upload.single('upl'), function(req,res){
      console.log(req.file.size); //form file size
this works great
but I don't know how to update the screen as a res.send wasn't working
Darryl Pargeter
@jessjo try res.json
Jess Johnson
thanks @darrylpargeter ! that worked! :)
jessjo sends brownie points to @darrylpargeter :sparkles: :thumbsup: :sparkles:
:star: 742 | @darrylpargeter | http://www.freecodecamp.com/darrylpargeter
Darryl Pargeter
@jessjo no prob =D
Jess Johnson
Amazing how the tiny things are what trip you up sometimes..
Darryl Pargeter
yer, that one little bit that makes everything fall into place, at lets it wasn't a missing ;
This message was deleted
Hey guys
so I'm relatively new to node and express
and I want to give it a go at one of the backend projects
like the voting app
I know it will take a lot of time going through tutorials etc. Does anyone have good resources for tutorials?
Jess Johnson
@wyattwade are you skipping the api projects?
Those are node and express
@jessjo haven't done them yet
even with those I'm having some difficulty
did you have any resource outside of FCC that helped @jessjo .
Rafael J. Rodriguez
I would like to pair with someone who has used JWT to secure an API
could use some help
Jess Johnson
@wyattwade - I struggled on the early ones too. Have you used the clementine.js tutorials? Those helped me deconstruct what I was trying to do. (http://www.clementinejs.com/tutorials/tutorial-beginner.html)
Can someone tell me why token authentication is preferred over a session cookie for private APIs?
I mean it makes sense for public APIs that you can access without an interface, but what about one that just serves a single-page app?
It's something I never understood.
Ka Lun Lee
@noinkling from my understanding, the benefit is for scaling. jwt are stateless and are sent with every request so the server doesnt need to keep track of it thus removing some stress on server . It just receives the payload (with the auth info) from the jwt, parses it, and accepts it if it matches. I remember reading something about jwt authentication working better with mobile too, but im not too sure about it. Aside from those things, i dont see much difference between session vs jwt
@noinkling i think this might make more sense to you: http://stackoverflow.com/questions/17000835/token-authentication-vs-cookies. it's about emberjs/rails, but the logic still applies.
Drew Sartorius
Is anyone familiar with HighStocks/HighCharts for making graphs?
Hi guys, I'm trying to login to my github account, in the cloud9 development environment
git config --global user.username <USerNamE>
this code is returning an error message
"bash: syntax error near unexpected token `newline'"
will you be able to help?
Anders Bengtsson
@Rafase282 I did my authentication for the Night coord app I am working on with JWT. I found it pretty straight forward compared with using the passport auth
Rafael J. Rodriguez
so you prefer JWT over passport-http/local?
Anders Bengtsson
@Rafase282 for sure, really straight forward I thought. I only done backend, but frontend should be really simple, store jwt in localstorage or in cookie, send it in header, body or url with requests to protected routes... header is prefered
Jon Lucas
For the Image Search Abstraction, does anyone have any tips for setting up the image search functionality? I've been struggling with using the google custom search api for the last day or so. I can get it to respond with search result data, but I can't seem to figure out how to limit that to results from google images, which seems to be what the example project is doing. Perhaps I'm barking up the wrong tree?
Darryl Pargeter
@jonslucas the best thing to do is ditch google and go with bing… yes bing, or imgur they have nice apis
Jon Lucas
Hmmm, I'll have to look into that. It's a little disappointing that I can't seem to figure it out though. It seems rather simple, like I'm just missing a certain query param in my request. And I can't seem to find the right google search term to get to the answer I'm looking for.
Thanks @darrylpargeter
jonslucas sends brownie points to @darrylpargeter :sparkles: :thumbsup: :sparkles:
:star: 744 | @darrylpargeter | http://www.freecodecamp.com/darrylpargeter
Darryl Pargeter
google search api was a bitch took me a long time to get it working, if you show me your code can try to help you (but coming form someone who used google api would say ditch it on the side of the road)
Jon Lucas
here is the link to the pertinent function I'm using to call the api:
but, I guess it's not too much trouble to just scrap it and start with the bing API
Anders Bengtsson

@Rafase282 Flow:

  1. register user, save user with hashed password (I used bcrypt)
  2. login: compare hashed passwords and if ok, create JWT, (I used "jsonwebtoken" npm mod) send back in res to client
  3. client send JWT in req, >> I did a simple middleware mod, that checks the JWT validity before routing to the protected route!

To logout user, you can simple delete token on the client side, but there are a way to revoke the token from server as well.

  • Protect your secret string, I put in .env
  • When you create token, don't forget to mask password in user object as the token is not encrypted only encoded, anyone can easily read a token
Rafael J. Rodriguez
@anders462 have you streamed before?
Anders Bengtsson
nope. haven't