LevelDB
A light-weight, single-purpose library for persistence with bindings to many platforms.
JavaScript Promises规范
https://cn.udacity.com/course/javascript-promises--ud898
JavaScript ES6
https://cn.udacity.com/course/es6-javascript-improved--ud356
npm 淘宝镜像
npm install --registry=https://registry.npm.taobao.org
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/dist \
--userconfig=$HOME/.cnpmrc"
IDE: VSCode
- globally installed ESlint
- change window scale under preference-settings
- change font to 16pt under ppreference-settings
Configuring your project
- Use NPM to initialize your project and create package.json to store project dependencies.
npm init
- Install crypto-js with --save flag to save dependency to our package.json file
npm install crypto-js --save
- Install level with --save flag
npm install level --save
Testing
To test code:
1: Open a command prompt or shell terminal after install node.js.
2: Enter a node session, also known as REPL (Read-Evaluate-Print-Loop).
node
3: Copy and paste your code into your node session
4: Instantiate blockchain with blockchain variable
let blockchain = new Blockchain();
5: Generate 10 blocks using a for loop
for (var i = 0; i <= 10; i++) {
blockchain.addBlock(new Block("test data "+i));
}
6: Validate blockchain
blockchain.validateChain();
7: Induce errors by changing block data
let inducedErrorBlocks = [2,4,7];
for (var i = 0; i < inducedErrorBlocks.length; i++) {
blockchain.chain[inducedErrorBlocks[i]].data='induced chain error';
}
8: Validate blockchain. The chain should now fail with blocks 2,4, and 7.
blockchain.validateChain();
Blockchain explorer
https://bitcoin.org/en/developer-glossary#section
Blockchain Developer Glossary
https://bitcoin.org/en/developer-glossary#section
JavaScript Promise
https://developers.google.com/web/fundamentals/primers/promises
Testnet:
https://en.bitcoinwiki.org/wiki/Testnet
Developer Test Application Examples
https://bitcoin.org/en/developer-examples#testing-applications
Bitcoin TestNet Sandbox Faucet
Resources for Web Services
Need a review for Web Services or Javascript? Checkout these courses:
Postman
POSTMAN is an application that allow you to test your endpoints with Graphical User Interface application.
To install Postman, go to Postman, and download & install the appropriate package for your OS.
Once you have it installed locally in your computer let’s do this test:
Open Postman and paste: https://maps.googleapis.com/maps/api/directions/json?origin=Florence&destination=Milan&waypoints=Genoa|Bologna|Venice&optimizeWaypoints=true&key=[YOUR_API_KEY]
Then, check the parameters in the param button and hit SEND option. The application make the request and should show you the response from the server api like it is showed in the video below.
https://s3.cn-north-1.amazonaws.com.cn/u-vid-hd/0LSjbIaQq0E.mp4
Documentation: https://www.getpostman.com/docs/v6/
CURL
CURL is used in command lines or scripts to transfer data, so it can be used to test our RESTful APIs.
Let’s check a quick example:
curl -X GET \
https://jsonplaceholder.typicode.com/todos/1 \
-H 'Cache-Control: no-cache' \
-H 'Content-Type: application/x-www-form-urlencoded' \
https://s3.cn-north-1.amazonaws.com.cn/u-vid-hd/9ctIhoEhsSs.mp4
Free Curl Book: https://curl.haxx.se/book.html
CSS and HTMLs
- Web Platform.org also has some pretty complete tutorials on CSS.
- Check out the jQuery website to learn more
- The Mozilla Developer Network (MDN) is a fantastic resource for all things web and JavaScript
JSON
JavaScript Object Notation. JSON is a popular and simple format for storing and transferring nested or hierarchal data. It’s so popular that most other programming languages have libraries capable of parsing and writing JSON (like Python’s JSON library). Internet GET and POST requests frequently pass data in JSON format. JSON allows for objects (or data of other types) to be easily encapsulated within other objects. See the MDN or JSON.org for more details.
This is a fantastic deep dive from Jason Lengstorf about JSON and its ubiquitous use in the form of AJAX requests.
Why should I lint my JSON?
With a mix of nested curly braces, square brackets and commas, it’s easy to make mistakes with JSON. And mistakes mean bugs. Seriously, I mess up JSONs all the time. You might even be able to spot a bug in one of my JSONs in a video in this course…
If you’re generating JSON by hand, you should copy and paste your code into a JSON linter like jsonlint.com to quickly and easily find syntax errors. A linter is a piece of software that analyzes code for syntax errors. Some text editors, like Sublime Text, will automatically lint (or highlight) most syntax errors. But a JSON linter won’t miss any syntax errors and you can rest assured that your JSONs will be properly formatted.
DOM
https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model
Nmap
You’ll also need to install ncat
, which is part of the Nmap network testing toolkit. We’ll be using ncat
to investigate how web servers and browsers talk to each other.
- Windows: Download and run https://nmap.org/dist/nmap-7.30-setup.exe
- Mac (with Homebrew): In the terminal, run
brew install nmap
- Mac (without Homebrew): Download and install https://nmap.org/dist/nmap-7.30.dmg
- Debian/Ubuntu/Mint: In the terminal, run
sudo apt-get install nmap
To check whether ncat
is installed and working, open up two terminals. In one of them, run ncat -l 9999
then in the other, ncat localhost 9999
. Then type something into each terminal and press Enter.
To exit the ncat
program, type Control-C in the terminal. If you exit the server side first, the client should automatically exit. This happens because the server ends the connection when it shuts down.
You’ll be learning much more about the interaction between clients and servers throughout this course.
13 Node.js frameworks
https://nordicapis.com/13-node-js-frameworks-to-build-web-apis/
Framework Homepages
Express.js Conclusion
This is an extremely powerful framework and there are many resources to help you get started. If you’re interested in learning more, they provide a great list of books and blogs on their site here.
Also, each of the modules along with their documentation are listed here.