DB設計
CMS開発シリーズの続きです node.js+ReactベースのCMS開発をはじめます node.js+React CMS を設計する(外部仕様)) node.js+React CMS を設計する(データベース仕様)) node.js+React CMS開発-サーバー雛形を作成 今回は前回作成した雛形にmongooseスキーマ&…
Express+mongooseでパスワードを暗号化して保存する方法 mongoose-bcrypt をインストール npm install mongoose-bcrypt --save app.js ルーティングの/ でデータ登録、/checkでパスワードをチェックしてみます app.js var mongoose = require('mongoose'); c…
Express+mongooseで RDBのようなAUTO INCREMENTフィールドを実現する mongoose-sequence パッケージをインストール $ npm install --save mongoose-sequence app.js var mongoose = require('mongoose'); const option = { useMongoClient: true, }; mongoos…
nexpressスキーマ構成を定義する。 必要最低限の要件を元にシンプルな構造を定義する。 1. Schemaに対する要件 ユーザー登録がエントリーポイント ユーザー ユーザーはサイトを複数作成できる サイトを新規作成したとき、自動的にそのサイトの最高権限ユーザ…