Help! stuck on this, even created token, etc
Err deprecated Replit
What exactly are you stuck on? I’m assuming you’re using Replit so you should really look at the note they give you about using the SECRETS tab.
You cannot create .env files in replit. What you did in that .env file you’re supposed to do on the Secrets tab on the left of your code right above the settings button.
Did it work? Unfortunately I can’t see what you put on your secrets .
There are a few issues.
I would first delete the index.js file.
In your myApp.js file you deleted some things like the module.exports.
You also reference a person object which looks like it was from the mongo challenges which is a whole other set of challenges.
I would just delete everything in the file and use this starter code.
var express = require('express');
var app = express();
console.log("Hello World")
app.get('/', (req,res)=>{
res.sendfile( __dirname + '/views/index.html')
})
app.use('/public', express.static(__dirname + '/public') )
//use app.get to transform the response object's message to uppercase
module.exports = app;
As for the environment variables, you need to use to use MESSAGE_STYLE
for the key and uppercase
for the value.
That’s what the directions say to do.
Then click on Add new secret.
Then you want to work on the last part of the challenge.
Then, in the /json
GET route handler you created in the last challenge, transform the response object’s message to uppercase if process.env.MESSAGE_STYLE
equals uppercase
. The response object should either be {"message": "Hello json"}
or {"message": "HELLO JSON"}
, depending on the MESSAGE_STYLE
value.
All of your logic is going to go inside the app.get method.
app.get('/json', (req, res) => {
CODE GOES HERE
})
Hope that helps!
almost there! The cleaner myApp gives me relief - watching tutorials on YouTube is exhausting.
https://boilerplate-express-3.rolag.repl.co/
Why is it not 100% correct!? please let me know you and Jose are awesome!
@ jwilkins.oboe @josejassojr
Where does jsonResponse
come from?
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.