/qidian-reader

An Brief Qidian Reader app based on Bootstrap + Angular UI Bootstrap, AngularJS, NodeJS+ExpressJS and MongoDB.

Primary LanguageJavaScript

Qidian Reader

An Brief Qidian Reader app based on Bootstrap + Angular UI Bootstrap, AngularJS, NodeJS+ExpressJS and MongoDB.

Files

.
├── models: MongoDB Models
├── public: Front-End Resources
│      ├── app: Angular App
│      │      ├── components
│      │      ├── shared
│      │      ├── app.module.js
│      │      └── app.routes.js
│      ├── assets: Resources
│      │      ├── css
│      │      ├── img
│      │      ├── js
│      │      └── libs: Bower Libraries
│      └── index.html
├── routes: Express Routes
│      ├── apis: RESTful API Routes
│      └── api.js: RESTful API Entrance
├── .bowerrc
├── .gitignore
├── bower.json
├── package.json
└── server.js

Initialization

  1. Make sure you have node installed with npm.
  2. Run npm install under the repository folder
    • It will handle node modules, bower, and bower modules.
    • Read .bowerrc and package.json for detail.
  3. For local debuging, adjust server.js to point to your local mongoDB.
  4. For local nodemon, use nodemon.json as the config.

Development

Storage

Remember to purchase storage, or a storage request forbidden error will show up when creating database associated.

Source & Secret

Source Secret is required for private repo deployment.

SSH

This credential uses ssh private/public key pairs to pull repo, and is safe because it can be assigned to single repo by deploy key.

  1. Create ssh key without passphrase (empty passphrase).
  2. Add ssh public key to the deploy key of the repo on git source.
  3. Create a Source Secret in OpenShift, with ssh private key. Remember: Do not modify after browse and import.
  4. Check link to builder account before create.
  5. In build config (where source is defined), assign the secret to the souce.
  6. SSH url will work. Remember: Do not use HTTP url, Do not add ssh:// before SSH url.

Basic Auth

This credential uses username and password to pull repo, but is not safe because the auth is not only for the target repo.

  1. Create a Source Secret in OpenShift, with basic auth: git source login information.
  2. Check link to builder account before create.
  3. In build config (where source is defined), assign the secret to the source.
  4. HTTP url will work. SSH url not tested.

Deployment

  • Use Webhooks, set PayLoad URL, set Content type as application/json, and then leave Secret Blank. For private repo, Secret field should be set. On OpenShift side, rebuild and deployment will automatically take place.
  • Use npm scripts.postinstall "npm install bower && bower install" to install bower component. Also use .bowerrc and bower.json to define bower install content.

Routing

To host an OpenShift app at a specified url, the following steps should be taken:

  1. Generate a default route for this app, naming internal-route for example.
  2. Generate a specified route for this app, naming external-route for example.
  3. Register the specified domain online (for example using Name).
  4. Under DNS settings add a CNAME DNS with your internal-route url as source, and your external-route url as destination.

References:

TODOs

  • deploy on HTTPS, and adjust Github link when complete
  • apply more secured authentication.
  • add notifications.
  • update last read chapter on QiDian Server.
  • pull bookcase from QiDian Server.