-
Notifications
You must be signed in to change notification settings - Fork 43
/
Copy pathapp.js
36 lines (28 loc) · 1.28 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var path = require('path')
var config = require('./config.json')
var express = require('express')
var session = require('express-session')
var app = express()
app.set('views', path.join(__dirname, 'views'))
app.set('view engine', 'ejs')
app.use(express.static(path.join(__dirname, 'public')))
app.use(session({secret: 'secret', resave: 'false', saveUninitialized: 'false'}))
// Initial view - loads Connect To QuickBooks Button
app.get('/', function (req, res) {
res.render('home', config)
})
// Sign In With Intuit, Connect To QuickBooks, or Get App Now
// These calls will redirect to Intuit's authorization flow
app.use('/sign_in_with_intuit', require('./routes/sign_in_with_intuit.js'))
app.use('/connect_to_quickbooks', require('./routes/connect_to_quickbooks.js'))
app.use('/connect_handler', require('./routes/connect_handler.js'))
// Callback - called via redirect_uri after authorization
app.use('/callback', require('./routes/callback.js'))
// Connected - call OpenID and render connected view
app.use('/connected', require('./routes/connected.js'))
// Call an example API over OAuth2
app.use('/api_call', require('./routes/api_call.js'))
// Start server on HTTP (will use ngrok for HTTPS forwarding)
app.listen(3000, function () {
console.log('Example app listening on port 3000!')
})