Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create PUT method to update the blogs #2

Open
Sara-pixie opened this issue Aug 13, 2021 · 1 comment
Open

Create PUT method to update the blogs #2

Sara-pixie opened this issue Aug 13, 2021 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed

Comments

@Sara-pixie
Copy link
Owner

You should be able to change the contents of your post without deleting it.

Possible tutorial: https://www.youtube.com/watch?v=sEkRmVfc8XE

@Sara-pixie Sara-pixie self-assigned this Aug 13, 2021
@Sara-pixie Sara-pixie added the enhancement New feature or request label Aug 13, 2021
@Sara-pixie Sara-pixie added the bug Something isn't working label Nov 23, 2021
@Sara-pixie
Copy link
Owner Author

At PUT request branch there is something wrong with the route from details.ejs when clicking on <a class="edit" href="/blogs/edit/<%= blog._id %>">Edit</a> it doesn't render edit.ejs, but 404.ejs.

It never even reaches the function inside the blogController.js (checking with console.log()):

const blog_edit_get = (req, res) => {
    console.log(req.params); //doesn't log anything...
    const id = req.params.id;
    Blog.findById(id)
        .then((result) => {
            console.log(result); //doesn't log anything either...
            res.render('blogs/edit', { blog: result, title: 'Edit Blog' });
        })
        .catch((err) => {
            console.log(err)
        })
}

@Sara-pixie Sara-pixie pinned this issue Nov 23, 2021
@Sara-pixie Sara-pixie added the help wanted Extra attention is needed label Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant