Skip to content

Markdown Wiki Engine Web Framework using MongoDB as well as Node.js

Notifications You must be signed in to change notification settings

usemodj/WikiCloth

Repository files navigation

WikiCloth

WikiCloth is a Wiki engine to create and edit a web page. It uses the Markdown syntax for plain text and the MathJax LaTeX syntax for the mathematical symbols.

As it operates as a web server, you can view the web pages created by any web browser, and edit a web page while logged in.

You can receive comments on each web page, then upload the files you can see the uploaded files in a Web page.

Each web page can compare the edited contents having changed history.

This project was generated with the Angular Full-Stack Generator version 3.7.6.

Getting Started

Prerequisites

  • Git
  • Node.js and npm: Node v9.3 (prefer yarn to npm)
  • Bower (npm install --global bower)
  • Ruby and then gem install sass
  • Gulp (npm install --global gulp , or yarn global add gulp if yarn installed)
  • MongoDB : Keep a running daemon with mongod

How to install the prerequisites:

/doc/how-to-install-prerequisites.md

Developing

  1. Run npm install(or, yarn install) to install server dependencies.

  2. Run bower install to install front-end dependencies.

  3. Run mongod in a separate shell to keep an instance of the MongoDB Daemon running

  4. Run gulp serve(or, npm start, yarn start) to start the development server. It should automatically open the client in your browser when ready.

For updating webdriver for protractor,

$ yarn update-webdriver
# Or,
$ npm update-webdriver

For running gulp serve:

$ yarn serve
# Or,
$ npm serve

For running gulp test:

$ yarn test
# Or,
$ npm test

Build & production

Change start.sample.sh to start.sh and modify it.

Run gulp build for building, mkdir dist/client/assets/upload for making upload directory and sh start.sh for production mode.

Run production mode

# For building into `dist/` directory:
$ gulp build
                                                                                                                                                                                                                                                                                                                    
# Go to `WikiCloth/dist/` directory and run `production` mode:
$ cd dist/

# To run `npm start` in `production` mode:
WikiCloth/dist$ NODE_ENV=production GOOGLE_ID=[id] GOOGLE_SECRET=[secret]  npm start

To run the server on production mode using PM2 process manager

Copy the start.sample.sh bash file to start.sh, modify the parameters, change the file mode to execute (chmod a+x start.sh) and then, run the shell script start.sh.

(prefer PM2 process manager to others)

PM2 - Advanced, production process manager for Node.js

# Install `PM2` globally:
$ yarn global add pm2

# Or, use this command:
$ sudo npm install -g pm2

$ pm2 --help

Testing

Running npm test will run the unit tests with karma.

issue solution

Running sudo npm rebuild node-sass

no such file or directory, scandir 'node_modules/node-sass/vendor'

Running sudo npm rebuild optipng

'node_modules/optipng-bin/vendor/optipng' ENOENT

Oauth login for people who already have social site accounts

facebook callbackURL: "{DOMAIN}:{PORT}/auth/facebook/callback"

twitter callbackURL: "{DOMAIN}:{PORT}/auth/twitter/callback"

google callbackURL: "{DOMAIN}:{PORT}/auth/google/callback"

Example for google console page:

DOMAIN='http://localhost' PORT=9000

google callbackURL: 'http://localhost:9000/auth/google/callback'

Those did not be saved to the configuration file("server/config/local.env.js", See "local.env.sample.js") for security reasons.