본문 바로가기

창고 331

Understanding asynchronous Javascript Asynchronous Javascript is very important topic since it controls a work flow that takes long time to finish. For example, saving model as an instance in database fetching external data from APIs in server This markdown docs summarizes below to lectures about asynchronous Javascript and JSON APIs. NetNinja : Asynchronous Javascript Free code camp : JSON APIs and Ajax Asynchronous Javascript Java.. 2022. 1. 17.
Node js 기초 2 Express Middleware Serving static webpages and assets could be simpler with express since it provides a middleware. Middleware is a function that takes route handlers and adds information. Express provdies the middleware to manage static assets. Without this middleware, all the static assets would require corresponding routes. // syntax : express.static(root + endpoint) // Normal usage app.use(e.. 2022. 1. 13.
Node js 기초 1 Client and Server interaction Front EndInteractionBackend event, DOM, template, routing HTTP, Ajax, JSON, RESTful Web server, template, routing, database, APIs There a few tech combinations for Node JS, which is MERN stack. MongoDB : database Express : framework React : UI library Node JS : server Node.js Node Package Manager One of the advantages to use npm is dependency control. Through packag.. 2022. 1. 12.
몽고 DB 기초 6 Comparison With Relational Database Relational DB : SQL Create two different tables and tangle them with SQL. MongoDB : No-SQL Create two different objects and nest. const mongoose = require('mongoose') const Schema = mongoose.Schema const BookSchema = new Schema({ title: String, pages: Number }) const AuthorScheam = new Schema({ name: String, age: Number, book: [BookSchema] // nested }) // mong.. 2022. 1. 11.
몽고 DB 기초 5 Login and Hash Database : MongoDB Client : Advanced REST client Password encryption : npm bcrypt library Checking user info in collection(before password hashing User password after hashing User login failed with wrong password Token With json web token npm library, a token is created like below. const token = jsonWebToken.sign(user._id.toHexString(), 'myToken') Client : setting the token into c.. 2022. 1. 10.
몽고 DB 기초 4 Testing With Mocha Mocha is a testing framework used to make test cases. Running tests consistently ensures newly added features are well integrated with previous ones. You can test such as : Creating records Reading records Updating records Deleting records Install Mocha like below npm install mocha --save // Installing mocha is not required for production setting. npm install mocha --save-dev .. 2022. 1. 7.

loading