chapter 05
section 04
models views routes & partials
# curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
# curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
# curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
# sudo apt purge nodejs
# sudo apt remove nodejs
# sudo apt-get install -y nodejs
npx express-generator --view=hbs --git notez
# npx [email protected] --view=hbs --git notez
cd notez && npm install
npm audit fix
git init
git add .
# npm i [email protected]
mkdir models
mkdir partials
touch models/Note.js
touch models/notes-memory.js
touch partials/header.hbs
touch routes/notes.js
touch views/noteedit.hbs
touch views/noteview.hbs
touch views/notedestroy.hbs
# DEBUG=notez:* npm start
git remote add origin https://github.com/TurtleWolf/Notez.git
git push -u origin master
git status
chapter 05
section 05
styles.css
chapter 05
section 06
package.json
chapter 06
section 04
jQuery Poppers BootStrap & assets
npm i bootstrap jquery [email protected]
mkdir public/assets
mv public/images/ public/javascripts/ public/stylesheets/ public/assets/
npm start
npm run server1
npm run server2
chapter 06
section 06
Mobile-first with feather-icons
npm i feather-icons
npm start
chapter 06
section 07
slate theme
npm run dl-slate
chapter 07
section 03
debug logging
REQUEST_LOG_FORMAT=common npm start
npm i rotating-file-stream
npm i fs-extra
# npm i util
DEBUG=express:* npm start
chapter 07
section 04
mjs modules
mv app.js app.mjs
mv bin/www bin/www.mjs
# cd models
mv models/Note.js models/Note.mjs
mv models/notes-memory.js models/notes-memory.mjs
# cd routes
mv routes/index.js routes/index.mjs
mv routes/notes.js routes/notes.mjs
# npm i esm
# npm -r esm start
# npm uninstall esm
chapter 07
section 05
storage file_system
import * as notes from '../models/notes-memory.mjs';
import * as notes from '../models/notes.mjs';
npm run start-fs
npm run server1
npm run server2
chapter 07
section 06
storage LevelUP
npm i level
touch models/notes-level.mjs
npm run start-level
chapter 07
section 07
SQL with SQLite3
npm i sqlite3
touch models/schema-sqlite3.sql
npm run sqlite3-setup
touch models/notes-sqlite3.mjs
npm run start-sqlite3
DEBUG=notez:* npm run start-sqlite3
npm run start-sqlite3
sqlite3 chap07.sqlite3
SQL with SQLite3
select * from notes;
chapter 07
section 08
ORM way with Sequelize
npm i sequelize
npm i js-yaml
touch models/notes-sequelize.mjs
touch models/sequelize-sqlite.yaml
chapter 07
section 09
MongoDB
1916 wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add -
1917 echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list
1919 sudo apt-get install -y mongodb-org
1920 which mongo
1921 mongo
1922 echo "mongodb-org hold" | sudo dpkg --set-selections
1923 echo "mongodb-org-server hold" | sudo dpkg --set-selections
1924 echo "mongodb-org-shell hold" | sudo dpkg --set-selections
1925 echo "mongodb-org-mongos hold" | sudo dpkg --set-selections
1926 echo "mongodb-org-tools hold" | sudo dpkg --set-selections
1927 sudo systemctl start mongod
1928 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
1929 echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
1930 sudo apt-get update
1931 sudo apt-get install -y mongodb-org
1932 sudo apt-get purge mongodb-org*
1933 Remove MongoDB
1934 mongo db
1935 sudo apt install mongodb-clients
1936 mongo db
1937 sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
1938 sudo apt-get purge mongodb-10gen
1939 sudo apt-get autoremove
1940 sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
1941 nano /etc/apt/sources.lists
1942 sudo nano /etc/apt/sources.lists
1943 nano /etc/apt/sources.lists
1945 sudo apt-get install mongodb-10gen
1946 sudo rm /var/lib/mongodb/mongod.lock
1947 mongod --repair
1948 sudo apt install mongodb-server-core
1949 sudo service mongodb start
1950 mongo
1951 mongodb
1952 mongod
1953 sudo service mongodb start
1954 mongo
1955 mongod
1956 mongod --repair
1957 which mongod
1960 sudo apt remove mongod
1961 mongodb
1962 sudo rm /var/lib/mongodb/mongod.lock
1963 sudo apt-get purge mongodb-org*
1964 sudo rm -r /var/log/mongodb /var/lib/mongodb
1965 sudo apt-get purge mongod*
1966 mongodb
1967 which mongod
1968 nano /etc/apt/sources.lists
1969 sudo nano /etc/apt/sources.lists
1970 nano /etc/apt/sources.lists
1975 which mongo
1976 mongo
1977 sudo apt install mongodb-clients
1978 mongo
1979 mongodb
1980 sudo apt uninstall mongodb-clients
1981 sudo apt remove mongodb-clients
1982 sudo apt purge mongodb-clients
1984 mongo
1985 which mongo
1986 mongodb
1987 mongod
1988 sudo apt install mongodb-server-core
1989 mongod
1990 sudo apt install mongodb-clients
1991 mongod
1992 which mongo
1993 mongodb
1994 mongod
1999 npm i mongodb
2000 npm audit
2002 touch models/notes-mongodb.mjs
---
## Chapter 08
---
### 8 - III
```bash section 3
section 3
section 4
section 5
section 6
section 7
section 8
section 9
chapter 07 section 04 es6 modules