Answer the question
In order to leave comments, you need to log in
How to define routes in the CRUD system in Express?
Maybe the question is not well-posed, but the essence is this.
For example, there are routes:
router.route('/')
.get((req, res) => {
// Просмотр какого нибудь списка
})
router.route('/:element')
.get((req, res) => {
// Просмотр элемента списка
})
.put((req, res) => {
// Обновление элемента списка
})
.delete((req, res) => {
// Удаление элемента списка
})
router.route('/add')
.get((req, res) => {
// Страница добавление элемента в список
})
.post((req, res) => {
// Добавление элемента в список
})
var obj = {
path : '/',
create : '/add',
read : '/:element',
update : '/:element',
delete : '/:element'
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question