Dilemme website
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
public
server
test
typings/node
.bowerrc
.env.sample
.gitattributes
.gitignore
.iron-node.js
.jscsrc
.jshintrc
.travis.yml
LICENSE.md
README.md
bower.json
gulpfile.js
jsconfig.json
karma.conf.js
package.json
server.js

README.md

Travis CI build status Codacy Badge Dependencies status Dev dependencies status

Build Status

Dilemme website

My future website, "Dilemme", French website based on either.io concept.

Work in progress.

Install and run

MongoDB is required.

Environment variables have to be set in a ".env" file at the root of the project (see .env.sample file) (I use dotenv).

7 environment variables are required :

  • NODE_ENV: "development" or "production"
  • ROOT_PATH: root URL (for example : http://dilemme.io, or http://localhost:3131) WITHOUT trailing slash but WITH leading "http://"
  • MONGO_URI: database URI, with user and password if required
  • MONGO_TEST_URI: test database URI, with user and password if required (only if you want to run tests)
  • GMAIL_USER: GMail user for sending mail
  • GMAIL_PASSWORD: GMail password for sending mail
  • FB_ID: Facebook app ID, used for Facebook authentication (create an app on Facebook developper website)
  • FB_SECRET: Facebook app secret
  • TWITTER_ID: Twitter app ID, used for Twitter authentication (create an app on Twitter developper website)
  • TWITTER_SECRET: Twitter app secret
  • GOOGLE_ID: Google app client ID, used for Google authentication (create an app and a client for the app on Google developper console and enable Google+ API access)
  • GOOGLE_SECRET: Google app client secret
  • CODACY_SECRET: Codacy token, used to send test coverage data to Codacy with Gulp codacy task

You must have gulp and bower installed too.

$ npm install -g gulp
$ npm install -g bower

Classic stuff to launch the application :

$ npm install
$ bower install
$ gulp build
$ node server

On the first start, sample data will be automatically pushed to the database.

Then go to http://localhost:3131 and everything should be fine.

Default admin credentials are 'joe'/'joe'.

Useful Gulp tasks

Build

$ gulp build
  • Concat and minify JS files
  • Build Stylus files to CSS, concat and minify CSS
  • Compile Jade views to HTML

Lint

$ gulp lint
  • Run JSHint on sources
  • Run JSCS on sources using Google JS Code Style customized with two rules :
    • No limitation for line length
    • Trailing white spaces forbidden

Watch

$ gulp watch
  • Launch server.js using gulp-nodemon
  • Watch for any change in JS sources (client side) and rebuild them
  • Watch for any change in Stylus sources and rebuild them
  • Same for Jade files
  • Watch for any change in JS files inside of /server directory and relaunch server.js

Debug

$ gulp debug
  • Launch server.js with debug port set to 3132
  • Watch files like the watch task

Test

$ gulp test
  • Launch tests (only some tests server side for now, work in progress)
  • Generate coverage report in coverage directory

Populate database with sample data

$ gulp init-db
  • Delete everything in the database and populate it with sample data (from server/data/sample directory)