Create tables/indexes on startup

Ready to create a request
This commit is contained in:
Daniel J. Summers
2017-09-16 13:16:02 -05:00
parent fc02112295
commit 270ac45e8c
8 changed files with 130 additions and 126 deletions

View File

@@ -1,7 +1,31 @@
'use strict'
const jwt = require('express-jwt')
const jwksRsa = require('jwks-rsa')
const config = require('../appsettings.json')
// Authentication middleware. When used, the
// access token must exist and be verified against
// the Auth0 JSON Web Key Set
const checkJwt = jwt({
// Dynamically provide a signing key
// based on the kid in the header and
// the singing keys provided by the JWKS endpoint.
secret: jwksRsa.expressJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: `https://${config.auth0.domain}/.well-known/jwks.json`
}),
// Validate the audience and the issuer.
audience: config.auth0.clientId,
issuer: `https://${config.auth0.domain}/`,
algorithms: ['RS256']
})
module.exports = {
mount: (app, checkJwt) => {
mount: app => {
app.use('/api/journal', require('./journal')(checkJwt))
}
}