tutorial from:https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs
- nodenv, node, express, mongodb
sdfsdf
/ redirects to /catalog
/catalog
/catalog/book /create :/id :id/update/ :id/delete
/catalog/books
same for bookinstance, author, genre
Changes to the tutorial:
- use case-insensitive RegExp in POST-routes instead of simple comparison for finding already posted rows
offene fragen/ selbst beheben
-
updates werden doch mit put oder patch gemacht und nicht mit post?!
-
update auf ES6..
Merken:
Falls sowas: /catalog/books/123/catalog/books... ist im Model, dass die Url erzeugt die url von der Form 'catalog/boo..' und muss zu '**/**catalog/boo..' geändert werden
Arrow functions
// ES5
hello = function(name) {
return "Hello " + name + "!";
}
// ES 6
How to use variable with regular expression to find case insensitive matches with mongoDB: in findOne().. as search condition..
{'name': new RegExp('^' +req.body.name + '$', 'i')}
The Node.js Way - Understanding Error-First Callbacks