html
head
title FCC Advanced Node and Express
meta(name='description', content='Profile')
link#favicon(rel='icon', href='https://hyperdev.com/favicon-app.ico', type='image/x-icon')
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(name='viewport', content='width=device-width, initial-scale=1')
link(rel='stylesheet', href='/public/style.css')
body
h1.border.center FCC Advanced Node and Express
//add your code below, make sure its indented at this level
h2.center#welcome Welcome, #{username}!
a(href='/logout') Logout
script(src='https://code.jquery.com/jquery-2.2.1.min.js', integrity='sha256-gvQgAFzTH6trSrAWoH1iPo9Xc96QxSZ3feW6kem+O00=', crossorigin='anonymous')
script(src='/public/client.js')
Basically it complains because the .env file is not filled with the correct properties. If you cannot connect to mongo you cannot connect to the database, and all of your routes and passport stuff are inside the callback of the connection ^^
I tried to move them out just to see something in the split screen: actually i can see the form but when i try to submit the values it crashes obviously ( there is no connection string or similar ^^ )
You can now uncomment the block in deserializeUser and remove your done(null, null) . Be sure to set DATABASE in your .env file to your database’s connection string (for example: DATABASE=mongodb://admin:pass@mlab.com:12345/my-project ). You can set up a free database on mLab. Congratulations- you’ve finished setting up serialization!
clck the button ‘connect’: this will open a modal where you can see the connection string you can use to connect your app ( not from shell or compass).
back to your glitch project, add your connection string to the .env file as the DATABASE value and fill out the other values too ( SECRET and SESSION_SECRET are just random strings, MADE_WITH …i have no idea ). Remember that in the .env file string can be written as is, it does not need quotation marks^^
Hey! Once again, thanks a lot for your help.
The connection string is there, but it isn’t shown for non-members. I assumed that only meant that everything under .env would be hidden, but based on what you’re saying seems it cannot be accessed either.
Ah my bad, didn’t knew that^^ You can hide it again for security reason, i can replace it with another one for testing purpose ^^
I can’t say what’s wrong at the moment , will look into it tomorrow morning!
Uhm…
I did some testing: after quite a bit i got that the app doesn’t save the user it retrieves in the cookie session (so when it redirects it lose the req.user), dunno if that is because i am not registered (thus the project is not saved) or about other reasons^^
Anyway that’s not the point: the only thing i can suggest to you is to add the initial forward slash and remove some spaces, something like this: '/views/pug/profile', {username:req.user.username}
It doesn’t work for me but i encountered some loading problem on glitch so…crossed fingers!
The original code was working perfectly and adhered to decent coding practices, but to pass the test, I could not use a constant for the pug directory, and I could not use a check to make sure that user was defined.
This whole section is currently under QA, but if you have any suggestions, you can head over to the GitHub repo, or #contributors subforum, and make a suggestion or contribute a fix.