mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
better logging and only in dev
This commit is contained in:
parent
18bfc85dca
commit
f44121bcc1
@ -12,6 +12,10 @@ const resolvers = {
|
||||
|
||||
const server = new ApolloServer({ typeDefs, resolvers })
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
process.env.DEBUG = true
|
||||
}
|
||||
|
||||
server.listen({ port: 3050 }).then(({ url }) => {
|
||||
console.log(`🚀 Nitro Embed - Server is ready at ${url}`)
|
||||
})
|
||||
|
||||
@ -67,16 +67,20 @@ const scraper = {
|
||||
meta = await scraper.fetchMeta(targetUrl)
|
||||
resolve()
|
||||
} catch(err) {
|
||||
if (process.env.DEBUG) {
|
||||
console.error(`ERROR at fetchMeta | ${err.message}`)
|
||||
}
|
||||
resolve()
|
||||
}
|
||||
}),
|
||||
new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
embed = await scraper.fetchEmbed(targetUrl)
|
||||
console.log(embed)
|
||||
resolve()
|
||||
} catch(err) {
|
||||
console.error(err)
|
||||
if (process.env.DEBUG) {
|
||||
console.error(`ERROR at fetchEmbed | ${err.message}`)
|
||||
}
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
@ -98,7 +102,6 @@ const scraper = {
|
||||
const embedMeta = find(oEmbedProviders, provider => {
|
||||
return provider.provider_url.indexOf(url.hostname) >= 0
|
||||
})
|
||||
console.log('embedMeta', embedMeta)
|
||||
if (!embedMeta) {
|
||||
return {}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user