Skip to content

Commit

Permalink
make path configurable, try reading standalone bundle w/o require.res…
Browse files Browse the repository at this point in the history
…olve()
  • Loading branch information
shawnbot committed Oct 14, 2020
1 parent 906a101 commit be337c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const envUrls = {
test: 'https://test-sfgov.pantheonsite.io'
}

const scriptSource = readFileSync(require.resolve('../dist/formio-sfds.standalone.js'), 'utf8')
const scriptSource = readFileSync('./dist/formio-sfds.standalone.js', 'utf8')
const banner = '/** injected by formio-sfds proxy */'
const footer = banner

Expand All @@ -21,13 +21,14 @@ module.exports = (req, res) => {
form: source,
options,
version,
env
env,
path = '/feedback'
} = req.query

res.setHeader('Content-Type', 'text/html')

const baseUrl = (env ? envUrls[env] : null) || LIVE_URL
const fetchUrl = `${baseUrl}/feedback`
const fetchUrl = `${baseUrl}${path}`

fetch(fetchUrl)
.then(fetched => fetched.text())
Expand Down

0 comments on commit be337c6

Please sign in to comment.