RESTful ROUTES table
Name | Path | HTML Verb | Purpose | Mongoose Method |
INDEX | /blogs | GET | List all blogs | Blog.find() |
New | /blogs/new | GET | Show new blog form | N/A |
Create | /blogs | POST | Create a new blog, then redirect somewhere | Blog.create() |
Show | /blogs/:id | GET | Show info about one specific blog | Blog.findById() |
Edit | /blogs/:id/edit | GET | Show edit form for one blog | Blog.findById() |
Update | /blogs/:id | PUT | Update a particular blog, then redirect somewhere | Blog.findByIdAndUpdate() |
Destroy | /blogs/:id | DELETE | Delete a particular blog, then redirect somewhere | Blog.findByIdAndRemove() |
# Sanitize(바람직하지 못한 부분을 삭제하다. 살균하다) blog body
# Style Index # Update REST Table
1. Sanitizer (block '<'script> tag from userside(req.body)
1) install sanitizer npm install express-sanitizer --save
2) call and config
const expressSanitizer = require("express-sanitizer"), app.use(expressSanitizer());
// Only requirement is expressSanitizer should be used after bodyParser
3) Apply sanitizer for CREATE and UPDATE
2. Edit index.ejs
1) Put all contents in the center
2) Other design
'Full stack development > The Web Developer Bootcamp(2020)' 카테고리의 다른 글
321. Note about RESTful Blog App: Final Touches (0) | 2020.10.01 |
---|---|
320. RESTful Blog App: DESTROY (0) | 2020.10.01 |
319. RESTful Blog App : EDIT AND UPDATE (0) | 2020.10.01 |
318. RESTful Blog App: SHOW (0) | 2020.10.01 |
317. Note about RESTful Blog App: SHOW (0) | 2020.10.01 |