- Exports constructor to create instance of Gwisp
Example
const gwisp = require('./lib/gwisp')
var app = gwisp({
verbose: true,
port: 9001,
dbUrl: 'mongodb://localhost/gwisp',
clientId: '327834646153-27e424bo1lpofea0lkfs8bvrf7sv5j2e.apps.googleusercontent.com',
clientSecret: 'y7RCBAr4AT26oACJBJUSJIxv',
redirectUrl: 'http://localhost:9001/v1/oauth/login',
scopes: [
'https://www.googleapis.com/auth/plus.me',
'profile',
'email'
]
})
app.start(function(err) {
// do some thing here
})
Classes
Type Definitions
Config
- Configuration of Gwisp
For knowledgement for clientId
, clientSecret
, redirectUrl
, scopes
,
accountUrl
, see
google oauth 2
For creation an oauth 2 application, go to developers
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
verbose |
boolean | Decide log request incomming |
port |
int | Which service listen on |
dbUrl |
string | Url to mongodb server |
dbUser |
string | Username of mongodb |
dbPass |
string | Password to access to mongodb |
clientId |
string | Client id of google oauth-2 |
clientSecret |
string | Secret key of google oauth-2 |
redirectUrl |
string | Which call by oauth-2 after successful |
scopes |
array | Array of string which scope of oauth-2 |
accountUrl |
string | Url to retrieve oauth-2 account |
Example
var config = {
verbose: true,
port: 9001,
dbUrl: 'mongodb://localhost/gwisp',
clientId: '327834646153-27e424bo1lpofea0lkfs8bvrf7sv5j2e.apps.googleusercontent.com',
clientSecret: 'y7RCBAr4AT26oACJBJUSJIxv',
redirectUrl: 'http://localhost:9001/v1/oauth/login',
scopes: [
'https://www.googleapis.com/auth/plus.me',
'profile',
'email'
]
}