netlify
Are you being servered?
@philhawksworth
dotJS, Paris, December 2019
const faunadb = require(‘faunadb’); const pageTemplate = require(‘./lollyTemplate.js’); const q = faunadb.query; const client = new faunadb.Client({ secret: process.env.FAUNADB_SERVER_SECRET }); exports.handler = (event, context, callback) !=> { const path = event.queryStringParameters.id.replace(“/”, “”); client.query( q.Get(q.Match(q.Index(“lolly_by_path”), path)) ).then((response) !=> { return callback(null, { statusCode: 200, body: pageTemplate(response.data) }); }).catch((error) !=> { return callback(null, { body: JSON.stringify(error), statusCode: 301, headers: { Location: /melted/index.html
, } }); }); }
Get page as a javascript l a r e it l e t a l p tem Authenticate with the DB Get the lolly data w ie v y l l o l e v r e S k a e r B . y l l o L o N the bad news