Go to file
2016-08-14 19:24:33 +02:00
bin Initial commit. 2016-08-14 19:18:09 +02:00
doc Initial commit. 2016-08-14 19:18:09 +02:00
gulp Initial commit. 2016-08-14 19:18:09 +02:00
less Initial commit. 2016-08-14 19:18:09 +02:00
server Initial commit. 2016-08-14 19:18:09 +02:00
src Set time and message in document.title. And updated notification text and image. 2016-08-14 19:24:33 +02:00
static Initial commit. 2016-08-14 19:18:09 +02:00
.babelrc Initial commit. 2016-08-14 19:18:09 +02:00
.eslintrc Initial commit. 2016-08-14 19:18:09 +02:00
.gitignore Initial commit. 2016-08-14 19:18:09 +02:00
gulpfile.js Initial commit. 2016-08-14 19:18:09 +02:00
package.json Initial commit. 2016-08-14 19:18:09 +02:00
README.md Initial commit. 2016-08-14 19:18:09 +02:00

MyPaper

Running

  1. $ git clone git@gitlab.thecodebureau.com:lohfu/pomodoro.git
  2. $ cd pomodoro
  3. $ npm install
  4. $ npm run gulp

Navigate to localhost:1337 (Node app runs on the port given in server/config/port, but Gulp starts a BrowserSync proxy that reloads your browser automatically when you change certain files).

Building (Production environment)

Simply call $ npm run gulp:production to run all build tasks in production mode, without starting the server.

Routes

Files & Directories

/img/raster

All raster images. Will be symlinked into /public/img.

/img/svg

All SVG images. Will be symlinked into /public/img in development ENV, and minified to the same location in production ENV.

/gulpfile.js

Runs the code in /gulp.

/gulp

This contains ALL gulp logic.

/gulp/config.js

This file contains all the configuration for the gulp tasks. Editing this file should be enough for most needs.

/less

This folder contains all SASS files and is compiled with the gulp sass task, which puts the output CSS into /public/css

/public

This directory is maintained by gulp. All static assets get symlinked in here, and any built code

This folder should not be edited directly, or commited to git. It is removed everytime gulp initializes.

/server

This directory contains all JavaScript that only has to do with running your server instance.

/server/middleware

Generic middleware that do not belong to a specific service.

Should export a single middleware function, or a namespaced object of functions.

/server/models

Shared models or models that do not belong to a specific service.

Should export the initialized model, ie:

module.exports = new mongoose.Model('Model', ModelSchema);

/server/routes

Routes that do not belong to a server.

Should return an array of route arrays ([ path, method, [ mw ] ])routes:

module.exports = [
  [ '/', 'get', [ mw.one, mw.two ] ],
  [ '/page', 'get', [ mw.three, mw.four ] ],
  [ '/page2', 'get', [ mw.five, mw.eight ] ]
];

/server/config

All configuration for the server. Most files export different options depending on the environment. A file might look like this:

module.exports = {
  development: {},
  testing: {},
  staging: {},
  production: {}
}[ENV];

If you want defaults applied, you might do something like this:

const defaults = {}

module.exports = Object.assign({}, defaults, {
  production: {}
}[ENV]);

In which case defaults will be used for all environments except production, in which the production settings will override any settings in defaults.

If you don't want to override, do this instead:

const defaults = {}

module.exports = {
  production: {}
}[ENV] || defaults);

/server/services

Instead of splitting models, middlewares and routes into three seperate folders, we create service directories that contain files relating to the same functionality.

/server/templates

Marko templates.

/src

This contains all isomorphic and pure browser JavaScript.

Browserify bundles these files (entry point is app.js) and outputs public/app.js.

/static

This contains all static content. All files in here are symlinked into /public, while retaining its relative path. IE /static/fonts/font.otf gets symlinked to /public/fonts/font.otf.

The only special files are robots.txt. In all ENV besides production robots.txt will be symlinked, in production environment robots-production.txt will be used instead.