From 153ebcf49b5e06046340750b737a73388a5ab03f Mon Sep 17 00:00:00 2001 From: Josh Burman Date: Thu, 14 Mar 2019 16:34:14 -0400 Subject: [PATCH] updated readme --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 30cd0e6..2f4098f 100755 --- a/README.md +++ b/README.md @@ -1,2 +1,43 @@ -# braid -websocket server for the measure platform +# BRAID v0.8.5 +## Websocket server for the Measure platform +--- +[![Build Status](https://semaphoreci.com/api/v1/projects/7767f0f3-4da6-4c84-9167-4db5402a3262/2573412/badge.svg)](https://semaphoreci.com/yardstick/braid) + +## Essential Information: +* braid uses [mocha (test framework)](https://www.npmjs.com/package/mocha), [chai (BDD/TDD assertion library)](https://www.npmjs.com/package/chai), [sinnon (spies, stubs, and mocks)](https://www.npmjs.com/package/sinon), [nyc (code coverage calculator)](https://www.npmjs.com/package/nyc) for our unit testing. Get aquainted with these packages to have a smooth unit testing experience. +* For web sockets braid uses [ws](https://www.npmjs.com/package/ws) +* Braid uses [typescript](https://www.npmjs.com/package/typescript) for our primary code development because of it's opinionated type management among other things. Get a good understanding of what typescript is, it's benifitsm drawbacks and dev flow + +## Local Development +* you can see if braid is running by typing in `https://ysbraid.localhost:8443` +* to connect to braid you need to use the url `wss://ysbraid.localhost:8443?token={token}` + * the token is generated in the application that you're connecting to the braid app with (currently only measure has an implementation for this) +* you can generate a token for development in you local console (`app-console`) with the following commands: + +``` +secret = "test" +payload = { + :data => { + :client => 'client name (mhs is only one implemented currently)', :client_type => 'site (only one in use rite now)', + :user_id => (yardstick user id), + :user_type => '(teacher/user)', + :channel => 'desired channel name' + }, + :sub => 'Braid JWT', + :aud => "internal", + :iss => 'Yardstick Software', + :exp => Time.now.to_i + 120 * 3600 (optional)} + +token = JWT.encode payload, hmac_secret, "HS256" + +``` + +## Setting up +* download the braid repo into a folder in the same director as the primary yardstick folder +* `vagrant up` in the primary yardstick folder +* run the command `compose stop braid && compose rm braid && tsc && compose build braid && compose up -d` + * `compose stop` stops the default braid container that `vagrant up` builds + * `compose rm braid` removes the default braid container + * `tsc` transpiles the typescript in braid into javascript + * `compose build braid` builds the braid container based on the latest transpiled javascript files + * `comopose up -d` builds the braid container based on the files in the braid folder, overriding the defaul braid build container