API¶
Namespace: AuthController
¶
Function: login
¶
Render the login page
The login form itself is just a simple HTML form:
<form role="form" action="/auth/local" method="post">
<input type="text" name="identifier" placeholder="Username or Email">
<input type="password" name="password" placeholder="Password">
<button type="submit">Sign in</button>
</form>
You could optionally add CSRF-protection as outlined in the documentation: http://sailsjs.org/#!documentation/config.csrf
A simple example of automatically listing all available providers in a Handlebars template would look like this:
{{#each providers}}
<a href="/auth/{{slug}}" role="button">{{name}}</a>
{{/each}}
The next
parameter can specify the target URL upon successful login.
Example: GET http://localhost:1337/login?next=http://localhost:1337/jbrowse?data=sample_data/json/volvox
-
login
(req, res)¶ Arguments: - req (Object) – request
- res (Object) – response
Function: login
¶
-
login
()
Function: logout
¶
Log out a user and return them to the homepage
Passport exposes a logout() function on req (also aliased as logOut()) that can be called from any route handler which needs to terminate a login session. Invoking logout() will remove the req.user property and clear the login session (if any).
For more information on logging out users in Passport.js, check out: http://passportjs.org/guide/logout/
Example: GET http://localhost:1337/logout
-
logout
(req, res)¶ Arguments: - req (Object) – request
- res (Object) – response
Function: register
¶
-
register
()¶
Function: loginstate
¶
get login state
GET http://localhost:1337/loginstate
Example Result:
{
"loginstate": true,
"user": {
"username": "juser",
"email": "juser@jbrowse.org"
}
}
-
loginstate
(req, res)¶ Arguments: - req (object) – request
- res (object) – response
Function: provider
¶
Create a third-party authentication endpoint
-
provider
(req, res)¶ Arguments: - req (Object) – request
- res (Object) – response
Function: callback
¶
Create a authentication callback endpoint
This endpoint handles everything related to creating and verifying Pass- ports and users, both locally and from third-aprty providers.
Passport exposes a login() function on req (also aliased as logIn()) that can be used to establish a login session. When the login operation completes, user will be assigned to req.user.
For more information on logging in users in Passport.js, check out: http://passportjs.org/guide/login/
-
callback
(req, res)¶ Arguments: - req (Object) – request
- res (Object) – response
Module: controllers/DatasetController
¶
Local Navigation
Description¶
REST Interfaces for Dataset model
Datasets are configure in config/globals.js
file.
See Dataset Model
Subscribe to Dataset events:
io.socket.get('/dataset', function(resData, jwres) {console.log(resData);});
io.socket.on('dataset', function(event){
consol.log(event);
}
Function: get
¶
Enumerate or search datasets
GET /dataset/get
-
get
(req, res)¶ Arguments: - req (object) – request data
- res (object) – response data
Module: controllers/JobActiveController
¶
Local Navigation
Description¶
REST interfaces for JobActive model.
See: JobActive model.
Subscribe to JobActive events:
io.socket.get('/jobactive', function(resData, jwres) {console.log(resData);});
io.socket.on('jobactive', function(event){
consol.log(event);
}
Function: get
¶
Read job active record
GET /jobactive/get
-
get
(req, res) Arguments: - req (object) – request
- res (object) – response
Module: controllers/JobController
¶
Local Navigation
Description¶
REST interfaces for Job model
See Job model.
Subscribe to Job events:
io.socket.get('/job', function(resData, jwres) {console.log(resData);});
io.socket.on('job', function(event){
consol.log(event);
}
Function: get
¶
Enumerate or search job list.
GET /job/get
Example usage (jQuery):
$.ajax({
url: "/job/get",
dataType: "text",
success: function (data) {
console.log(data)
}
});
The returned data
is a JSON array of job objects.
Example Job object:
{
"id": 113,
"type": "workflow",
"progress": "100",
"priority": 0,
"data": {
"service": "serverSearchService",
"dataset": "sample_data/json/volvox",
"searchParams": {
"expr": "ttt",
"regex": "false",
"caseIgnore": "true",
"translate": "false",
"fwdStrand": "true",
"revStrand": "true",
"maxLen": "100"
},
"name": "ttt search",
"asset": "113_search_1513478281528",
"path": "/var/www/html/jbconnect/node_modules/jbrowse/sample_data/json/volvox/ServerSearch",
"outfile": "113_search_1513478281528.gff",
"track": {
"maxFeatureScreenDensity": 16,
"style": {
"showLabels": false
},
"displayMode": "normal",
"storeClass": "JBrowse/Store/SeqFeature/GFF3",
"type": "JBrowse/View/Track/HTMLFeatures",
"metadata": {
"description": "Search result job: 113"
},
"category": "Search Results",
"key": "113 ttt results",
"label": "113_search_1513478281528",
"urlTemplate": "ServerSearch/113_search_1513478281528.gff",
"sequenceSearch": true
}
},
"state": "complete",
"promote_at": "1513478280038",
"created_at": "1513478280038",
"updated_at": "1513478292634",
"createdAt": "2018-02-01T05:38:27.371Z",
"updatedAt": "2018-02-01T05:38:27.371Z"
}
-
get
(req, res) Arguments: - req (object) – request
- res (object) – response
Function: submit
¶
Submit a job.
Example - submit sequence search:
var postData = {
service: "serverSearchService",
dataset: "sample_data/json/volvox,
searchParams: searchParams
};
$.post("/job/submit, postData, function(retdata) {
console.log(retdata)
},'json');
Returned data from job submit: { status: "success", jobId: 152 }
, where
jobId
is the id of the created job in the job queue.
-
submit
(req, res)¶ Arguments: - req (object) – request
- res (object) – response
Module: controllers/ServiceController
¶
Local Navigation
Description¶
REST interfaces for Service model.
See Service model
Subscribe to Service events:
io.socket.get('/service', function(resData, jwres) {console.log(resData);});
io.socket.on('service', function(event){
consol.log(event);
}
Function: get
¶
Enumerate job services (jservices)
GET /service/get
-
get
(req, res) Arguments: - req (object) – request
- res (object) – response
GET or POST /service/exec/
This example calls set_filter, a JBlast operation:
var postData = {
filterParams: data,
asset: "jblast_sample",
dataset: "sample_data/json/volvox"
}
$.post( "/service/exec/set_filter", postData , function( data) {
console.log( data );
}, "json");
The returned data depends on the service function that is called.
Module: controllers/TrackController
¶
Local Navigation
Description¶
REST interfaces for TrackController
Subscribe to Track events:
io.socket.get('/track', function(resData, jwres) {console.log(resData);});
io.socket.on('track', function(event){
consol.log(event);
}
Function: get
¶
enumerate tracks or search track list.
Get all tracks
GET /track/get
Get filtered tracks by dataset:
GET /track/get?id=1
where id is the dataset id
GET /track/get?path=sample_data/json/volvox
where path is the dataset path
-
get
(req, res) Arguments: - req (object) – request
- res (object) – response
Function: get_tracklist
¶
get JBrowse tracklist
GET /track/get_tracklist
-
get_tracklist
(req, res)¶ Arguments: - req (object) – request
- res (object) – response
Function: add
¶
add a new track
POST /track/add
Must include “dataset” in the fields, which can be the path (string) or id (int)
Calling example:
let newTrack = {
"dataset":"sample_data/json/volvox",
"autocomplete": "all",
"track": "EST",
"style": {
"className": "est"
},
"key": "HTMLFeatures - ESTs",
"feature": [
"EST_match:est"
],
"storeClass": "JBrowse/Store/SeqFeature/NCList",
"urlTemplate": "tracks/EST/{refseq}/trackData.json",
"compress": 0,
"label": "EST",
"type": "FeatureTrack",
"category": "Miscellaneous"
};
$.post( "/track/add", newTrack, function( data ) {
console.log( "result", data );
}, "json");
-
add
(req, res)¶ Arguments: - req (object) – request
- res (object) – response
Function: modify
¶
modify an existing track
POST /track/modify
Calling example:
let modifyTrack = {
"autocomplete": "all",
"track": "EST",
"style": {
"className": "est"
},
"key": "HTMLFeatures - ESTs",
"feature": [
"EST_match:est"
],
"storeClass": "JBrowse/Store/SeqFeature/NCList",
"urlTemplate": "tracks/EST/{refseq}/trackData.json",
"compress": 0,
"label": "EST",
"type": "FeatureTrack",
"category": "Miscellaneous"
};
$.post( "/track/modify", modifyTrack, function( data ) {
console.log( "result", data );
}, "json");
-
modify
(req, res)¶ Arguments: - req (object) – request
- res (object) – response
Function: remove
¶
remove an existing track
POST /track/remove
Calling example:
$.post( "/track/remove", { id: 23 }, function( data ) {
console.log( "result", data );
}, "json");
-
remove
(req, res)¶ Arguments: - req (object) – request
- res (object) – response
Module: controllers/UserController
¶
Local Navigation
Description¶
REST interfaces for UserController
Subscribe to User events:
io.socket.get('/user', function(resData, jwres) {console.log(resData);});
io.socket.on('user', function(event){
consol.log(event);
}
Function: get
¶
Enumerate or search users
GET /user/get
-
get
(req, res) Arguments: - req (object) – Enumerate or search users
GET /user/get
:param object res: Enumerate or search usersGET /user/get
Module: models/Dataset
¶
Local Navigation
Description¶
Dataset is a model that represents the JBrowse dataset. Generally, this includes path to the dataset and some of the data contained in trackList.json.
Datasets known to JBConnect are defined in config/globals.js (see: Configuration)
Dataset object:
{
"name": "Volvox",
"path": "sample_data/json/volvox",
"createdAt": "2018-02-01T05:38:26.320Z",
"updatedAt": "2018-02-01T05:38:26.320Z",
"id": 1
}
Ref: Sails Models and ORM
Function: Init
¶
Initializes datasets as defined in config/globals.js. (see: Configuration)
-
Init
(params, cb)¶ Arguments: - params (object) – callback function
- cb (function) – callback function
Return undefined: Initializes datasets as defined in config/globals.js.
(see: Configuration)
Function: Get
¶
Get list of tracks based on critera in params
-
Get
(params, cb)¶ Arguments: - params (object) – search critera (i.e.
{id: 1,user:'jimmy'}
) - cb (function) – callback
function(err,array)
- params (object) – search critera (i.e.
Function: Resolve
¶
Given either a dataset string (ie. “sample_data/json/volvox” or the database id of a dataset, it returns a dataset object in the form:
{
path: "sample_data/json/volvox",
id: 3
}
-
Resolve
(dval)¶ Arguments: - dval (val) – dataset string (ie. “sample_data/json/volvox”) or id (int)
Code Example
{ path: "sample_data/json/volvox", id: 3 }
Return object: - dataset object
dataset (string - i.e. “sample_data/json/volvox” if input was an id returns null if not found
Function: Sync
¶
Sync datasets, defined in globals with database.
todo: need to improve, perhaps use async?
-
Sync
()¶ Arguments: - Sync() – cb - callback function
Module: models/Job
¶
Local Navigation
- Description
- Function:
Init
- Function:
Get
- Function:
Remove
- Function:
Submit
- Function:
_jobRunner
- Function:
_kueEventMonitor
- Function:
_pushEvent
- Function:
_processNextEvent
- Function:
_createJob
- Function:
_updateJob
- Function:
kJob
- Function:
sJob
- Function:
_destroyJob
- Function:
_listJobs
- Function:
_syncJobs
- Function:
kJobs
- Function:
sJobs
Description¶
Job model is an encapsulation of the Kue job framework.
Kue uses redis database. This model synchronizes the Job database with the redis data through the use of Kue’s API.
- Kue event messages are stuffed into a FIFO _eventList and dequeued with _processNextEvent to ensure order.
- Example Job object:
{
"id": 113,
"type": "workflow",
"progress": "100",
"priority": 0,
"data": {
"service": "serverSearchService",
"dataset": "sample_data/json/volvox",
"searchParams": {
"expr": "ttt",
"regex": "false",
"caseIgnore": "true",
"translate": "false",
"fwdStrand": "true",
"revStrand": "true",
"maxLen": "100"
},
"name": "ttt search",
"asset": "113_search_1513478281528",
"path": "/var/www/html/jbconnect/node_modules/jbrowse/sample_data/json/volvox/ServerSearch",
"outfile": "113_search_1513478281528.gff",
"track": {
"maxFeatureScreenDensity": 16,
"style": {
"showLabels": false
},
"displayMode": "normal",
"storeClass": "JBrowse/Store/SeqFeature/GFF3",
"type": "JBrowse/View/Track/HTMLFeatures",
"metadata": {
"description": "Search result job: 113"
},
"category": "Search Results",
"key": "113 ttt results",
"label": "113_search_1513478281528",
"urlTemplate": "ServerSearch/113_search_1513478281528.gff",
"sequenceSearch": true
}
},
"state": "complete",
"promote_at": "1513478280038",
"created_at": "1513478280038",
"updated_at": "1513478292634",
"createdAt": "2018-02-01T05:38:27.371Z",
"updatedAt": "2018-02-01T05:38:27.371Z"
}
Event Mappings:
Kue Events | Job Events |
---|---|
|
create |
|
update |
|
update |
|
update |
|
update |
|
update |
|
remove |
|
unused |
Ref: Sails Models and ORM
Function: Get
¶
Get list of tracks based on critera in params
-
Get
(params, cb) Arguments: - params (object) – search critera (i.e.
{id: 1,user:'jimmy'}
) - cb (function) – callback function(err,array)
- params (object) – search critera (i.e.
Function: Remove
¶
-
Remove
(id)¶ Arguments: - id (int) – id of the item to be removed
- Remove(id) – cb - callback function(err,
Function: Submit
¶
-
Submit
()¶
Function: _jobRunner
¶
-
_jobRunner
()¶
Function: _kueEventMonitor
¶
-
_kueEventMonitor
()¶
Function: _pushEvent
¶
-
_pushEvent
()¶
Function: _processNextEvent
¶
-
_processNextEvent
()¶
Function: _createJob
¶
-
_createJob
()¶
Function: _updateJob
¶
-
_updateJob
()¶
Function: kJob
¶
-
kJob
()¶
Function: sJob
¶
-
sJob
()¶
Function: _destroyJob
¶
-
_destroyJob
()¶
Function: _listJobs
¶
-
_listJobs
()¶
Function: _syncJobs
¶
Synchronize all kue jobs (kJobs) and sails db jobs (sJobs) Called upon initialization of the Job model
if the kJob exists but sJob does not, then create the sJob from kJob. If the sJob exists but not kJob, then delete the sJob
-
_syncJobs
()¶
Function: kJobs
¶
-
kJobs
()¶
Module: models/JobActive
¶
Local Navigation
Description¶
JobActive holds a count of the number of active jobs. It only contains one record that gets updated when the number of active jobs changes. A timer thread monitors the job queue for active jobs and updates the JobActive record with any changes to the number of active jobs. Subscribers to the record (clients) will get notification. JBClient plugin uses this to determine if a job is active and changes the activity icon of the job queue panel.
JobActive object example:
{
"active": 0,
"createdAt": "2017-11-23T00:53:41.864Z",
"updatedAt": "2018-02-07T07:59:32.471Z",
"id": 1
}
Function: Init
¶
initialize starts the job active monitor
-
Init
(params, cb) Arguments: - params (object) – value is ignored
- cb (type) – callback
function cb(err)
Function: Get
¶
Get list of tracks based on critera in params
-
Get
(params, cb) Arguments: - params (object) – search critera (i.e.
{id: 1,user:'jimmy'}
) - cb (function) – callback
function(err,array)
- params (object) – search critera (i.e.
Module: models/Passport
¶
Local Navigation
Description¶
The Passport model handles associating authenticators with users. An authen- ticator can be either local (password) or third-party (provider). A single user can have multiple passports, allowing them to connect and use several third-party strategies in optional conjunction with a password.
Since an application will only need to authenticate a user once per session, it makes sense to encapsulate the data specific to the authentication process in a model of its own. This allows us to keep the session itself as light- weight as possible as the application only needs to serialize and deserialize the user, but not the authentication data, to and from the session.
Function: hashPassword
¶
Hash a passport password.
-
hashPassword
(password, next)¶ Arguments: - password (Object) – password
- next (function) – next policy
Module: models/Service
¶
Local Navigation
Description¶
The service module implements the job service frameowrk which are installable modules that can host web services and be a job execution processing for a particular type of job.
Installable services are generally named <servicename>Service.js and reside in the api/services directory. For example: a job service built into this project is serverSearchService.js
api/services/serviceProc.js is the bettr part of the implementation of service
Job services are defined in config/globals.js in the jbrowse/services section.
Example job service object:
{
"name": "serverSearchService",
"type": "service",
"module": "search",
"createdAt": "2018-02-01T05:38:26.289Z",
"updatedAt": "2018-02-07T07:59:31.430Z",
"id": 1
}
Module: models/Track
¶
Local Navigation
Description¶
Track is a model for a list of tracks that are in the trackList.json
’s [tracks]
section.
Ref: Sails Models and ORM
Track object example:
{
"dataset": 1,
"path": "sample_data/json/volvox",
"lkey": "DNA",
"trackData": {
"seqType": "dna",
"key": "Reference sequence",
"storeClass": "JBrowse/Store/Sequence/StaticChunked",
"chunkSize": 20000,
"urlTemplate": "seq/{refseq_dirpath}/{refseq}-",
"label": "DNA",
"type": "SequenceTrack",
"category": "Reference sequence"
},
"createdAt": "2018-02-01T05:38:26.339Z",
"updatedAt": "2018-02-01T05:38:26.339Z",
"id": 1
}
Function: Init
¶
-
Init
(params, cb) Arguments: - params (type) – parameters
- cb (type) – callback function
Function: StartWatch
¶
-
StartWatch
()¶
Function: PauseWatch
¶
-
PauseWatch
()¶
Function: ResumeWatch
¶
-
ResumeWatch
()¶
Function: Get
¶
Get list of tracks based on critera in params
-
Get
(params, cb) Arguments: - params (object) – search critera
- cb (function) – callback
function(err,array)
Function: GetTrackList
¶
Get JBrowse tracklist in JSON format of tracks based on critera in params
-
GetTrackList
(params, cb)¶ Arguments: - params (object) – search critera
- cb (function) – callback
function(err,json)
Function: Add
¶
-
Add
()¶
Function: Modify
¶
-
Modify
()¶
Function: Remove
¶
-
Remove
(dataset, id) Arguments: - dataset (string) – (eg: “sample_data/json/volvox”)
- id (int) – id of the item to be removed
- id) (Remove(dataset,) – cb - callback function(err,
Function: Sync
¶
Sync tracklist.json tracks with Track model (promises version)
-
Sync
(dataset) Arguments: - dataset (string) – ie. (“sample_data/json/volvox”)
Function: SyncTest
¶
-
SyncTest
()¶
Function: cleanTracks
¶
remove all tracks for a given user. if params.session does not exist or user not logged in, returns false.
-
cleanTracks
(params)¶ Arguments: - params (object) – remove all tracks for a given user.
if params.session does not exist or user not logged in, returns false. :return int: returns true if successful, false if nothing done
Constant: Promise
:
Constant: fs
:
Constant: path
:
Constant: deferred
:
Constant: deepmerge
:
Constant: _
:
Module: models/User
¶
Local Navigation
Description¶
User is the data model for a user.
Example User object:
{
"username": "juser",
"email": "juser@jbrowse.org",
"admin": true,
"createdAt": "2017-11-29T21:00:56.726Z",
"updatedAt": "2017-11-29T21:00:56.726Z",
"id": 2
}
Module: policies/bearerAuth
¶
Local Navigation
Description¶
bearerAuth Policy
Policy for authorizing API requests. The request is authenticated if the it contains the accessToken in header, body or as a query param. Unlike other strategies bearer doesn’t require a session. Add this policy (in config/policies.js) to controller actions which are not accessed through a session. For example: API request from another client
Module: policies/isAdmin
¶
Local Navigation
Description¶
isAdmin policy provides passage if the user contains the property admin: true.
req.session looks something like this: req.session Session {
- cookie: { path: ‘/’,
- _expires: null, originalMaxAge: null, httpOnly: true
}, passport: { user: 2 }, authenticated: true, (true if logged in, user: { username: ‘juser’, email: ‘juser@jbrowse.org’ }
}
Module: policies/passport
¶
Local Navigation
Description¶
Passport Middleware
Policy for Sails that initializes Passport.js and as well as its built-in session support.
In a typical web application, the credentials used to authenticate a user will only be transmitted during the login request. If authentication succeeds, a session will be established and maintained via a cookie set in the user’s browser.
Each subsequent request will not contain credentials, but rather the unique cookie that identifies the session. In order to support login sessions, Passport will serialize and deserialize user instances to and from the session.
For more information on the Passport.js middleware, check out: http://passportjs.org/guide/configure/
Module: policies/sessionAuth
¶
Local Navigation
Description¶
Simple policy to allow any authenticated user. Assumes that your login action in one of your controllers sets req.session.authenticated = true;
Module: services/jbutillib
¶
Local Navigation
- Description
- Function:
doExtScripts
- Function:
getMergedConfig
- Function:
mergeConfigJs
- Function:
getClientDependencies
- Function:
injectIncludesIntoHtml
- Function:
setupPlugins
- Function:
removeIncludesFromHtml
- Function:
unsetupPlugins
- Function:
safeCopy
- Function:
safeWriteFile
- Function:
install_database
- Function:
zapRedis
- Function:
injectPlugins
- Function:
injectTracklist
- Function:
buildWebpack
- Function:
removePlugins
- Function:
getPlugins
- Function:
addRoute
- Function:
addPluginRoute
Description¶
Support library for jbutil command
Function: doExtScripts
¶
Traverse jbutils-ext.js
of submodules (*-jbconnect-hook)
-
doExtScripts
(cb)¶ Arguments: - cb (function) – callback
Function: getMergedConfig
¶
Returned merged jbrowse config.
Merged from *-jbconnect-hook
config/globals.js
, local config/globals.js
-
getMergedConfig
()¶
Function: mergeConfigJs
¶
-
mergeConfigJs
()¶
Function: getClientDependencies
¶
-
getClientDependencies
(filter)¶ Arguments: - filter (string) – (ie. “.css” or “.js”)
Return Array: the aggregated client dependencies from webIncludes.
Function: safeCopy
¶
copy src to targ, but if targ exists, it will backup the target by appending a number
-
safeCopy
(src, origTarg)¶ Arguments: - src (string) – source
- origTarg (string) – target
Return string: final target filename
Function: safeWriteFile
¶
if content is the same as target, do nothing. if content is different than target, write new content to target file.
-
safeWriteFile
(content, origTarg)¶ Arguments: - content (type) – content to write
- origTarg (type) – target file
Return string: backuped up filename
Function: install_database
¶
Install the sails database from ./bin
.
-
install_database
(overwrite)¶ Arguments: - overwrite (int) – 0, do not overwrite db. 1, overwrite db.
Function: injectPlugins
¶
Inject client-side plugins into the JBrowse plugins dir
Note: as of JBrowse 1.13.0, you must run npm run build after this function, webpack build. called in sails lift /tasks/register .. jb-inject-plugins to function properly
if env E2E_COVERAGE is defined, it will instrument the plugins before installing.
Example: // injects plugins and instruments JBClient plugin and builds webpack in JBrowse ./jbutil –pushplugins –coverage JBClient –buildwebpack
-
injectPlugins
(plugin)¶ Arguments: - plugin (string) – if defined (ie. “JBClient”), it will instrument the given plugin
Return injectPlugins(plugin): (int) count - count of plugins injected.
Function: injectTracklist
¶
-
injectTracklist
()¶
Function: buildWebpack
¶
-
buildWebpack
()¶
Function: getPlugins
¶
get the list of plugins. This includes JBConnect plugins as well as plugins of JBConnect hook modules that are loaded.
-
getPlugins
()¶ Return object: array of plugin objects
Function: addRoute
¶
Add a route
-
addRoute
(params, module, route, target)¶ Arguments: - params (object) – eg.
{app: <app-object>,express: <express-object>}
- module (string) – the module name (ie.
"jquery"
) - route (string) – the route (ie.
"/jblib/jquery"
) - target (string) – the target (ie
"/var/www/html/jbconnect/node_modules/jquery"
)
- params (object) – eg.
Function: addPluginRoute
¶
Add a plugin route
-
addPluginRoute
(params, module, route, target)¶ Arguments: - params (object) – eg.
{app: <app-object>,express: <express-object>}
- module (string) – the module name (ie.
"jblast"
) - route (string) – the route (ie.
"/jbrowse/plugins/JBlast"
) - target (string) – the target (ie
"/var/www/html/jbconnect/node_modules/jblast-jbconnect-hook/plugins/JBlast"
)
- params (object) – eg.
Constant: fs
:
Constant: path
:
Constant: approot
:
Constant: glob
:
Constant: sh
:
Constant: merge
:
Constant: config
:
Constant: html2json
:
Constant: json2html
:
Constant: _
:
Constant: async
:
Module: services/passport
¶
Local Navigation
Description¶
Passport Service
A painless Passport.js service for your Sails app that is guaranteed to Rock Your Socks™. It takes all the hassle out of setting up Passport.js by encapsulating all the boring stuff in two functions:
passport.endpoint() passport.callback()
The former sets up an endpoint (/auth/:provider) for redirecting a user to a third-party provider for authentication, while the latter sets up a callback endpoint (/auth/:provider/callback) for receiving the response from the third-party provider. All you have to do is define in the configuration which third-party providers you’d like to support. It’s that easy!
Behind the scenes, the service stores all the data it needs within “Pass- ports”. These contain all the information required to associate a local user with a profile from a third-party provider. This even holds true for the good ol’ password authentication scheme – the Authentication Service takes care of encrypting passwords and storing them in Passports, allowing you to keep your User model free of bloat.
Module: services/postAction
¶
Local Navigation
Description¶
Used by hooks to add a track and announce to subscribers.
Function: addToTrackList
¶
Add track to track list and notify.
-
addToTrackList
(kJob, newTrackJson)¶ Arguments: - kJob (object) – kue job reference
- newTrackJson (JSON) – new track JSON
Module: services/serviceProc
¶
Local Navigation
Description¶
Support functions for Service model.
Function: init
¶
initialize the job service framework
-
init
(params, cb2)¶ Arguments: - params (type) – parameters
- cb2 (type) – callback
Function: addService
¶
add a service
-
addService
(service, cb)¶ Arguments: - service (object) – service
- cb (function) – callback