Merge pull request #14 from netlify-templates/2/fix-import

fix (#2): use directory to import static files
This commit is contained in:
Ben Hong 2022-02-23 08:31:47 -08:00 committed by GitHub
commit 0168b22e4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
// Jokes provided from the lovely folks at https://icanhazdadjoke.com // Jokes provided from the lovely folks at https://icanhazdadjoke.com
import jokes from './jokes.json' import jokes from './data/jokes.json'
export const handler = (event) => { export const handler = async () => {
// Generates a random index based on the length of the jokes array // Generates a random index based on the length of the jokes array
const randomIndex = Math.floor(Math.random() * jokes.length) const randomIndex = Math.floor(Math.random() * jokes.length)
const randomJoke = jokes[randomIndex] const randomJoke = jokes[randomIndex]