Skip to content

Commit

Permalink
fix: CORS on /info
Browse files Browse the repository at this point in the history
  • Loading branch information
mvayngrib committed Nov 18, 2017
1 parent b3184f6 commit db9a5fb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/routes/info.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/cli/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function getTableBucketDefinition ({
ProjectionType: 'ALL'
// ProjectionType: 'INCLUDE',
// NonKeyAttributes: [
// TYPE
// TYPE, '_link'
// ]
},
ProvisionedThroughput: {
Expand Down
6 changes: 6 additions & 0 deletions src/routes/info.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import coexpress = require('co-express')
import cors = require('cors')
import helmet = require('helmet')
import Tradle from '../tradle'
import { timestamp } from '../utils'

Expand All @@ -7,10 +9,14 @@ export = function attachHandler ({ tradle, router }: {
router:any
}) {
const { init, user, logger } = tradle
router.use(cors())
router.use(helmet())
router.get('/info', coexpress(function* (req, res) {
logger.debug('[START] /info', timestamp())
yield init.ensureInitialized()
logger.debug('initialized')
const result = yield user.onGetInfo()
logger.debug('got result')
res.json(result)
}))
}

0 comments on commit db9a5fb

Please sign in to comment.