verso prod

This commit is contained in:
lesion 2022-01-21 11:40:58 +01:00
parent c69ba7e497
commit b9847571f3
9 changed files with 19 additions and 13 deletions

View file

@ -44,7 +44,7 @@ export default {
async fetch() { async fetch() {
console.error('dentro fetch') console.error('dentro fetch')
console.error(this.cohort) console.error(this.cohort)
this.posts = await this.$http.$get(`http://localhost:3000/api/cohort/${this.cohort.id}`, this.posts = await this.$http.$get(`/api/cohort/${this.cohort.id}`,
{ params: { maxPosts: this.maxPosts }}) { params: { maxPosts: this.maxPosts }})
// console.error(res) // console.error(res)
// .then(res => res.json()) // .then(res => res.json())

View file

@ -16,7 +16,7 @@ export default {
cohort: Object cohort: Object
}, },
async fetch(props) { async fetch(props) {
const res = await fetch(`http://localhost:3000/api/cohort/${props.cohort.id}`).then(res => res.json()) const res = await fetch(`/api/cohort/${props.cohort.id}`).then(res => res.json())
return { cohort: res.cohort, posts: res.posts } return { cohort: res.cohort, posts: res.posts }
}, },
} }

View file

@ -45,7 +45,7 @@ export default ({
// cohort: // cohort:
}), }),
async fetch () { async fetch () {
const res = await $fetch(`http://localhost:3000/api/cohort/${props.cohort.id}`, const res = await $fetch(`/api/cohort/${props.cohort.id}`,
{ params: { maxPosts: props.maxPosts }}) { params: { maxPosts: props.maxPosts }})
// .then(res => res.json()) // .then(res => res.json())
return res return res

View file

@ -24,12 +24,16 @@ export default {
css: [ css: [
], ],
server: {
host: '0'
},
render: { render: {
static: { static: {
// Add CORS header to static files. // Add CORS header to static files.
setHeaders(res) { setHeaders(res) {
res.setHeader('Access-Control-Allow-Origin', '*'); res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET'); res.setHeader('Access-Control-Allow-Methods', 'GET, OPTIONS');
res.setHeader( res.setHeader(
'Access-Control-Allow-Headers', 'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept' 'Origin, X-Requested-With, Content-Type, Accept'
@ -42,6 +46,10 @@ export default {
plugins: [ plugins: [
], ],
env: {
baseUrl: process.env.BASE_URL || 'http://localhost:3000'
},
// Auto import components: https://go.nuxtjs.dev/config-components // Auto import components: https://go.nuxtjs.dev/config-components
components: true, components: true,

View file

@ -48,7 +48,7 @@ export default {
methods: { methods: {
copy (ev, item) { copy (ev, item) {
console.error('dentro copy') console.error('dentro copy')
const str = `<display-feed feed='http://localhost:3000/api/source/${item.id}'></display-feed>` const str = `<display-feed feed='${process.env.baseUrl}/api/source/${item.id}'></display-feed>`
try { try {
navigator.clipboard.writeText(str) navigator.clipboard.writeText(str)
} catch (e) { } catch (e) {

View file

@ -49,11 +49,11 @@ export default {
}, },
computed: { computed: {
code () { code () {
return `<display-feed feed="http://localhost:3000/api/source/${this.source && this.source.id}"></display-feed>` return `<display-feed feed="${process.baseUrl}/api/source/${this.source && this.source.id}"></display-feed>`
}, },
feed () { feed () {
if (this.source && this.source.id) { if (this.source && this.source.id) {
return `http://localhost:3000/api/source/${this.source.id}` return `${process.baseUrl}/api/source/${this.source.id}`
} else { } else {
return '' return ''
} }

View file

@ -92,7 +92,7 @@ export default {
}), }),
async fetch() { async fetch() {
// const lastPosts = await fetch('http://localhost:3000/api/posts').then(res => res.json()) // const lastPosts = await fetch('http://localhost:3000/api/posts').then(res => res.json())
this.cohorts = await this.$http.$get('http://localhost:3000/api/cohorts') this.cohorts = await this.$http.$get('/api/cohorts')
}, },
watch: { watch: {
async search (value) { async search (value) {
@ -117,8 +117,7 @@ export default {
this.sources = [] this.sources = []
}, },
copy (ev, item) { copy (ev, item) {
console.error('dentro copy') const str = `<display-feed feed='${process.env.baseUrl}/api/cohort/${item.id}'></display-feed>`
const str = `<display-feed feed='http://localhost:3000/api/cohort/${item.id}'></display-feed>`
try { try {
navigator.clipboard.writeText(str) navigator.clipboard.writeText(str)
} catch (e) { } catch (e) {

View file

@ -27,7 +27,7 @@ export default {
// components: { AddCohort, Cohort, TextCohort, Post }, // components: { AddCohort, Cohort, TextCohort, Post },
data: () => ({ lastPosts: [], cohorts: [] }), data: () => ({ lastPosts: [], cohorts: [] }),
async fetch() { async fetch() {
this.lastPosts = await this.$http.$get('http://localhost:3000/api/posts') this.lastPosts = await this.$http.$get(`${process.env.baseUrl}/api/posts`)
// this.cohorts = await this.$http.$get('http://localhost:3000/api/cohorts') // this.cohorts = await this.$http.$get('http://localhost:3000/api/cohorts')
// const cohorts = [] // const cohorts = []
}, },

View file

@ -129,18 +129,17 @@ let queue
export async function add (s) { export async function add (s) {
queue.add(s, { jobId: s.id, repeat: { every: 10000 } }) queue.add(s, { jobId: s.id, repeat: { every: 10000 } })
manager.get(s)
} }
async function main () { async function main () {
queue = new Queue('foo6', { limiter: { max : 10, duration: 20000 } }) queue = new Queue('foo6', { limiter: { max : 10, duration: 20000 } })
console.error('dentro main')
queue.clean(1000) queue.clean(1000)
await queue.obliterate({ force: true }); await queue.obliterate({ force: true });
queue.process(job => manager.get(job.data)) queue.process(job => manager.get(job.data))
const sources = await prisma.source.findMany() const sources = await prisma.source.findMany()
console.error(sources)
// sources.forEach(manager.get) // sources.forEach(manager.get)
// manager.get() // manager.get()
// console.error(sources.map(s => s.URL)) // console.error(sources.map(s => s.URL))