Ouroboros is a collection of various JavaScript tools and frameworks which aims to speed up developing Single Page Applications. The application comes with a user registration and login system.
First install Ouroboros globally to have access to the oro
application (not
published yet):
npm install -g ouroboros
Or get the latest code and link it:
git clone https://github.com/mustardamus/ouroboros.git
cd ouroboros
npm install
npm link
Creates a new folder project-name
with all the things needed to start a new
project. All NPM and Bower dependencies will be installed automatically.
Using Foreman, it starts several
processes at once (see ./Procfile
):
mongod
- Start MongoDB.java -jar ./lib/selenium-server-standalone-2.48.2.jar
- Start a Standalone Selenium Server to be used by Nightwatch for the end2end testing.node ./node_modules/forever/bin/forever -c coffee -f -m 3 --watch --watchDirectory="server" server/index.coffee
- Start the Express.js server located in./server
with Forever. Every time the code in./server
changes, the server will be restarted. Default port is 9991.node ./node_modules/forever/bin/forever -c coffee -f -m 3 --watch --watchDirectory="lib" lib/devServer.coffee
- Start the BrowserSync development server. Every time code in./client
changes, the application is freshly bundled and the browser reloads. Every time code in./lib
changes, the development server is restarted. Default port is 9990.
This command will prompt you with a list of templates to generate files from and
variables used in these templates. Templates are located in ./templates
and
defined in ./templates/index.coffee
.
Minifies the JavaScript files ./public/libs.js
and ./public/bundle.js
with
UglifyJS. The stylesheet
./public/bundle.css
is minified with CSSO.
Run this command after releasing a new build on the server to reduce loading time and file sizes.
Define third party libs that are loaded as globals in ./client/index.coffee like so:
###
global ../node_modules/vue/dist/vue.js
###
window.Vue is then defined, for example. This makes building the bundle with browserify a billion times faster.
To exclude a global script, but still have the path available, just make then path invalid, with a # for example:
global #../bower_components/semantic/dist/components/accordion.js
If you set a menu param to a route, it will be automatically included in the Top navigation:
'/users':
name: 'users'
component: require('../components/page-users')
params:
menu: { name: 'All Users', icon: 'users' }
This will load the /tests/index.js file with will expand the test case with every spec*.coffee, can also be in a subdirectory.
npm install nightwatch -g
nightwatch
Sending a request via @$crud, but without sending the authentication token along:
@$crud().read()
@$crud(id).read()
Sending a request with the authentication token:
@$crud(null, true).read()
@$crud(id, true).read()
Make sure you have the auth middleware included. This will remove the authentication token from the query built by CRUD, so it works properly:
auth = require('../middleware/auth')
class Route
constructor: (@config, @app, @crud, @cm, @models, @io) ->
@crud.entity('/posts')
.Read()
.use auth(@config, @models)
.pipe @cm.findOne(@models.user)