GithubHelp home page GithubHelp logo

node-course-2-todo-api's Introduction

----------------------------------------
Starting and connecting to MongoDB
----------------------------------------

cd C:\Program Files\MongoDB\Server\4.0\bin
mongod.exe --dbpath d:/mongo-data

C:\Program Files\MongoDB\Server\4.0\bin
mongo

> db.Todos.insert({text: 'Create new Node course'})
> db.Todos.find()

Download and install https://robomongo.org/ (like PHPMyAdmin / MySQL Workbench)

----------------------------------------
MongoDB Vocabulary
----------------------------------------

SQL:      Table
NoSQL:    Collection

SQL:      Row / Record
NoSQL:    Document

SQL:      Column
NoSQL:    Field / Property


--------------------------------
Node MongoDB Native Package
--------------------------------

https://github.com/mongodb/node-mongodb-native
Installation: npm install mongodb --save


--------------------------------
More about MongoDB id
--------------------------------

- it's a 12 byte value
- first 4 bytes is a timestamp (it means in our documents we don't need to have a 'created_at' field)
- next 3 bytes is a machine identifier
- next 2 bytes a process id
- next 3 bytes a counter (this is similar to what MySQL would do with an autocomplete field)


--------------------------------
ES6 destructuring
--------------------------------

// ES6 destructuring
// - it's a fantastic way to make new variables from an object's properties
var user = { name: 'Andrew', age: 25 };
var {name} = user;
console.log(name);


--------------------------------
Running tests
--------------------------------

npm run test - this one is running via nodemon
npm run test-watch - this one is running via nodemon

--------------------------------
Mongoose ORM
--------------------------------
https://mongoosejs.com/


--------------------------------
Postman
--------------------------------
https://www.getpostman.com/
It's an essential tool if you're building an API.
Postman lets you create HTTP requests and fire them off - makes it easy to test that everything you're writing it's working as expected.

Download the Postman app and install it to use Postman.

--------------------------------
Body Parser Package
--------------------------------
https://www.npmjs.com/package/body-parser

Node.js body parsing middleware
Parse incoming request bodies in a middleware before your handlers, available under the req.body property.

--------------------------------
HTTP status codes
--------------------------------
https://httpstatuses.com/
Get a list of all available HTTP status codes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.