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() {
console.error('dentro fetch')
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 }})
// console.error(res)
// .then(res => res.json())

View file

@ -16,7 +16,7 @@ export default {
cohort: Object
},
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 }
},
}

View file

@ -45,7 +45,7 @@ export default ({
// cohort:
}),
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 }})
// .then(res => res.json())
return res

View file

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

View file

@ -48,7 +48,7 @@ export default {
methods: {
copy (ev, item) {
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 {
navigator.clipboard.writeText(str)
} catch (e) {

View file

@ -49,11 +49,11 @@ export default {
},
computed: {
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 () {
if (this.source && this.source.id) {
return `http://localhost:3000/api/source/${this.source.id}`
return `${process.baseUrl}/api/source/${this.source.id}`
} else {
return ''
}

View file

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

View file

@ -27,7 +27,7 @@ export default {
// components: { AddCohort, Cohort, TextCohort, Post },
data: () => ({ lastPosts: [], cohorts: [] }),
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')
// const cohorts = []
},

View file

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