Skip to content

shufflebyte/locallibrary

Repository files navigation

LocalLibrary

tutorial from:https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs

Used technonlogy

  • nodenv, node, express, mongodb

Screenshot

sdfsdf

MongoDB Database Layout

Library Website - Mongoose_Express

Routes

/ 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')}

Links to read

RegExp, how to use it in JS

The Node.js Way - Understanding Error-First Callbacks

https://sass-lang.com/guide

callback hell8

How to write a production-ready nodejs rest api

MongoDB in 5 Minutes (YT)

Express - Validator

PUG

W3C Cool URIs dont' change

About

Express Tutorial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published