yelpcamp's People
Forkers
calvinmagezi vedantkarle sanjaybabu2210 atharva131 furkanahmed2 marcosdemelo1980 karankartikeya leslieki tonnyleao jerfuj reniuszka nax3t purelycapital avinashkamal ayan-paul7086 sukriti1112 anusha0310 shaurya127 anisha2510 spassaro80 pjdiiori leonsoares pascalr2014 dinobobo wach-e shivam4162 tomskr alkaseem ahmadhasan288 aleksandrryb jatinthakwani-07-05 sushovanpaul07 amlan-xyz aegis301 emiliamajzner sushantaa shirleyxia-996 joenutt chandunagella githunter0 kevin-van-deventer damarowen vverheij vardhmanjain wankew22 anshul-bhawsar mercurymicca shawnp1337 favoureez jahangirbabar2000 adina-mamadalieva frankliu02 arhamnewaz dcoug wmingcr neerajregaltos amysimps1 alicethankam as2340 prasannaraja98 anshpurii s4hubhamp aqbawa chowdeswararaop zenefits-brody emtrixx david-chenebault 88warren rajatk0007 marshmadness516 lizettelacson spreoteasa jcsorgei terrychen0402 motor-cycle nesngenes tabele86 alexanderwinkelmeier sheerimpulse anin-4 vimcoper kenspectacle betomoreno-iam ironclad1979 ezhilarasi08 arpit160 danidarshan575 alexdabash vivek27951 rozhinzayeri chriscjfern jmparpet amirzimhony robertvonderbecke mmustafa86 honettegloria renneslei sergslat carlosrevespt kartik1902yelpcamp's Issues
Mapbox needs Credit Card defaultly now
Campground New & Create - POST not working
After adding the POST method to make the "Add Campground" button works, nothing happens. No error or anything. I can't find anything wrong with the code. Please help!
`const express = require('express');
const path = require('path');
const mongoose = require('mongoose');
const Campground = require('./models/campground');
mongoose.connect('mongodb://localhost:27017/yelp-camp', {
useNewUrlParser: true,
// useCreateIndex: true, doesn't work in Mongoose 6
useUnifiedTopology: true
})
const db = mongoose.connection;
db.on("error", console.error.bind(console, "connection error:"));
db.once("open", () => {
console.log("Database connected");
});
const app = express();
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'))
app.use(express.urlencoded( {extended: true}));
app.get('/', (req, res) => {
res.render('home')
});
app.get('/campgrounds', async (req, res) => {
const campgrounds = await Campground.find({});
res.render('campgrounds/index',{ campgrounds })
});
app.get('/campgrounds/new', (req, res) => {
res.render('campgrounds/new');
})
app.post('/campgrounds', async (req, res) => {
const campground = new Campground(req.body.campground);
await campground.save();
res.redirect(/campgrounds/${campground._id}
)
})
app.get('/campgrounds/:id', async (req, res) => {
const campground = await Campground.findById(req.params.id)
res.render('campgrounds/show', { campground });
})
app.listen(3000, () => {
console.log('Serving on port 3000')
})`
Bootstrap dismissible alert close button not working in Chrome
The button appears on the left and won't close when clicked.
The Campground show page is not working.
the page is showing an error and stating -> Cannot read property 'username' of null at eval .
Can someone help me in solving this issue
Simplified Passport/Passport-Local Configuration
Hello @Colt
For the app.js file while we are using authentication over passport there is an update.
Starting from version 0.2.1, passport-local-mongoose adds a helper method createStrategy as static method to your schema. The createStrategy is responsible to setup passport-local LocalStrategy with the correct options. Bacuse of this no need to define LocalStrategy and using this lines of code : passport.use(new LocalStrategy(User.authenticate()));
We could update this lines as below:
const User = require('./models/user');
// CHANGE: USE "createStrategy" INSTEAD OF "authenticate"
passport.use(User.createStrategy());
The Campground show page is not working
the page is showing an error and stating -> Cannot read property 'username' of null at eval .
Can someone help me in solving this issue
Images are not deleted from cloudinary when the whole campground is deleted.
The images are only deleted when we edit the campground. Deleting campground deletes the link to it, not the image.
Heroku deploying not working properly.
Invalid Signature 43584e4a95f65d120a2aab4dcbae2b9cde0f5724. String to sign - 'folder=YelpCamp×tamp=1654175189'.
I am getting this error every time I try to create a new campgound.
Things breaking after deploying the site
warning: LF will be replaced by CRLF in app.js.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in public/javascripts/validateForms.js.
The file will have its original line endings in your working directory
this is the message I am getting while executing 'git add .' in git bash.
then in the site, some pages are not working like the campground add is not working.
error while uploading/deleting image
cloudinary display image
in app.js
-
"https://res.cloudinary.com/douqbebwk/", //SHOULD MATCH YOUR CLOUDINARY ACCOUNT!
-
"https://res.cloudinary.com/"+ process.env.CLOUDINARY_CLOUD_NAME +"/",
in order to match the environment variable of the user.
also a readme with setup explanation would help people who are unfamiliar with environment variables
export MAPBOX_TOKEN=...
export CLOUDINARY_CLOUD_NAME=...
export CLOUDINARY_KEY=...
export CLOUDINARY_SECRET=...
source ~/.zshrc
Home Page Styling
In the Udemy course Colt uses Bootstrap alpha 5, whereas I'm using 5.1.3
How do I get my styling to make the page look the same ?
method-override for DELETE routing.
Hi. method-override isn't working for the DELETE routing. Does anyone have a solution to this issue? Thanks.
How to change the password of user if they have forgotten it or want to change it?
Greate course and project but this part were missed and I think is important. I checked the net but no solution related to passport js was found.
ReturnTo behavior not working.
The url is there when the site redirects to /login but is removed when the post request is made. So it always redirects to /campgrounds
Mongo connection error
I kept receiving a notification whenever I would run nodemon telling me there was a vulnerability and suggesting I run an audit. I did and it said I should update mongoose to a new version. Ever since the update I'm getting this error and I can't start the server:
connection error: MongoParseError: options usecreateindex, usefindandmodify are not supported
at Object.parseOptions (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\connection_string.js:291:15)
at new MongoClient (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\mongo_client.js:62:46)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:779:16
at new Promise ()
at NativeConnection.Connection.openUri (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:776:19)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:330:10
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
at new Promise ()
at promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:1151:10)
(node:12200) UnhandledPromiseRejectionWarning: MongoParseError: options usecreateindex, usefindandmodify are not supported
at Object.parseOptions (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\connection_string.js:291:15)
at new MongoClient (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongodb\lib\mongo_client.js:62:46)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:779:16
at new Promise ()
at NativeConnection.Connection.openUri (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\connection.js:776:19)
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:330:10
at C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:32:5
at new Promise ()
at promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:10)
at Mongoose._promiseOrCallback (C:\Users\prett\desktop\WebDev\YelpCamp\node_modules\mongoose\lib\index.js:1151:10)
(Use node --trace-warnings ...
to show where the warning was created)
(node:12200) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict
(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:12200) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejectio
reviews not getting push in to campground review array, getting property of review null error
module.exports.create=async(req,res,next)=>{
const campgrounds= await campGround.findById(req.params.id)
const reviewsss= new reviews(req.body.review)
reviewsss.author= req.user._id
campgrounds.review.push('reviewsss')
console.log(campgrounds.review)
await reviewsss.save()
await campgrounds.save()
req.flash('success','review created')
res.redirect(/campground/${campgrounds._id}
)
}
Error while register (not able to register more than 1 person)
E11000 duplicate key error collection: yelp-camp.users index: emial_1 dup key: { emial: null }
Error using Joi Validation Middleware
I used Joi validation and it worked perfectly the last time I worked on the project. The next video had a middleware made from it and nothing works after that. I even reverted back to my previous code and it still doesnt work.
First while using the middleware i got an error saying 'cannot read properties of undefined reading('validate')' at my validateCampground function.
Then I made some changes to the code and it said that " 'campground' is required" .
Now, even when all of the inputs pass the validation, it still shows the above error.
I remove the validateCampground middleware, everything works fine. I even checked the documentation and couldnt find the problem anywhere.
ReturnTo behavior not working
I am having trouble implementing the feature that allows you to redirect the user to where they were before they were asked to log in. In an effort to debug the code, I tried console.logging the session twice: once in the login get route (i.e. the route that renders the login page), and once in the login post route (i.e. the route the login form submits to). As seen in the screenshots below, in the login get route, the session does contain returnTo: '/campgrounds/new'. However, the session in the login post route does not. The only piece of code that gets executed between these two console.logs is the passport.authenticate() middleware. It seems like that middleware is responsible for the loss of returnTo: '/campgrounds/new' and I can't seem to figure out how to fix that.
`router.get('/login', (req, res) => {
console.log("session inside login get route:");
console.log(req.session);
res.render('users/login');
});
router.post('/login', passport.authenticate('local', { failureFlash: true, failureRedirect: '/login' }), (req, res) => {
console.log("session inside login post route:");
console.log(req.session);
req.flash('success', 'welcome back!');
const redirectUrl = req.session.returnTo || '/campgrounds';
delete req.session.returnTo;
res.redirect(redirectUrl);
});`
heroku not working
Invalid Signature 43584e4a95f65d120a2aab4dcbae2b9cde0f5724. String to sign - 'folder=YelpCamp×tamp=1654175189'.
i am getting this error every time i try to create a new campgound.
MongoDBStore session broke, needs a clear fix
const MongoDBStore = require("connect-mongo")(session);
const secret = process.env.SECRET || 'thisshouldbeabettersecret!';
const store = new MongoDBStore({
url: dbUrl,
secret,
touchAfter: 24 * 60 * 60
});
store.on("error", function (e) {
console.log("SESSION STORE ERROR", e)
})
const sessionConfig = {
store,
name: 'session',
secret,
resave: false,
saveUninitialized: true,
cookie: {
httpOnly: true,
// secure: true,
expires: Date.now() + 1000 * 60 * 60 * 24 * 7,
maxAge: 1000 * 60 * 60 * 24 * 7
}
}
app.use(session(sessionConfig));
Cloudinary and multer-storage-cloudinary libraries not able to install as they a re no longer maintained, sharing the photo of the errors generated ,need a fix asap!!!
can't able to take image in my project
extra '/' in edit.ejs
`<div class="valid-feedback">
Looks good!
fix all routes
Hi Colt, I have seen some redundancy on the routes of the project, you should exclude the loading of the models from the routes since it is an operation that the controllers do.
Congratulations again for the course ;)
quick fix for seeds/index.js since unsplash API changed and requires an access key
-
Install axios
npm i axios
-
Add the dependency in seeds/index.js
const axios = require('axios');
-
Add these two lines of code in the loop using your own client key from unsplash dev section
const res = await axios.get('https://api.unsplash.com/photos/random?client_id=[Access_Key]&collections=9046579');
const image = res.data.urls.small;
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.