bnason
bnason
Explore posts from servers
NNuxt
Created by bnason on 11/1/2024 in #❓・help
Nuxt Devtools not working
Hmm I think it has to do with @vite-pwa/nuxt
7 replies
NNuxt
Created by bnason on 11/1/2024 in #❓・help
Nuxt Devtools not working
That did not resolve the isssue
7 replies
CDCloudflare Developers
Created by bnason on 10/22/2024 in #general-help
Serve url on any subdomain
I think the Origin Rule I setup is working. I have to modify my app to add a base tag in the head so that all my scripts/images are properly loaded however. All that could be done in a worker/snippet but this seems to be the easier option for now.
9 replies
NNuxt
Created by bnason on 10/23/2024 in #❓・help
Reference assets with domain name
This is what I came up with: ~~/server/plugins/meta-base.ts
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html, { event }) => {
html.head.unshift(`<base href="https://foo.example.com/" />`)
})
})
export default defineNitroPlugin((nitroApp) => {
nitroApp.hooks.hook('render:html', (html, { event }) => {
html.head.unshift(`<base href="https://foo.example.com/" />`)
})
})
6 replies
CDCloudflare Developers
Created by bnason on 10/22/2024 in #general-help
Serve url on any subdomain
Not yet. I tihink I could also accomplish this via Workers AND snippets? Is there any benefit either way?
9 replies
CDCloudflare Developers
Created by bnason on 10/22/2024 in #general-help
Serve url on any subdomain
The only thing in front of them all is CloudFlare
9 replies
CDCloudflare Developers
Created by bnason on 10/22/2024 in #general-help
Serve url on any subdomain
We do not have a single load balancer in front of all the subdomains. Some are hosted internally while some are hosted by our software vendoer and we don't have any control over their lbs
9 replies
CDCloudflare Developers
Created by bnason on 10/22/2024 in #general-help
Serve url on any subdomain
Would that be an Origin Rule? With expression of(starts_with(http.request.uri.path, "/__debug")) and then Host Header Rewrite, SNI Rewrite, and DNS Record Override pointing to foo.example.com?
9 replies
NNuxt
Created by bnason on 10/16/2024 in #❓・help
Shared types/utils
So far, I've gotten this so far which works for everything except types in *.d.ts files
nitro: {
imports: {
dirs: ['./shared/types', './shared/utils'],
},
},
imports: {
dirs: ['../shared/types/**', '../shared/utils/**'],
},
nitro: {
imports: {
dirs: ['./shared/types', './shared/utils'],
},
},
imports: {
dirs: ['../shared/types/**', '../shared/utils/**'],
},
2 replies
NNuxt
Created by bnason on 8/26/2024 in #❓・help
Auto import types
So I have a file ./typess/common.d.ts and in it I have type FooBar = { foo: string, bar: number } but FooBar is not defined in any of my source files
5 replies
NNuxt
Created by bnason on 8/26/2024 in #❓・help
Auto import types
I have my common.d.ts which exports an interface. If I use declare interface instead is that the correct way?
5 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
yea i just have the dumb apparently. I was putting a client composable in the server utils ... all I can say is its friday...
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
grr im on a call and working on multiple things and got them mixed up, 1 sec let me get organized real quick lol
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
im wonddering if there is some hidden error? I'm not getting anything in build or vscode
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
this is whats in my file
import { useFetch } from 'nuxt/app'
import { ref } from 'vue'

export const useFetchTime = () => {
const start = ref<DOMHighResTimeStamp | undefined>()
const time = ref<number | undefined>()

const fetchOptions: Pick<NonNullable<Parameters<typeof useFetch>[1]>, 'onRequest' | 'onResponse'> = {
onRequest({ request, options }) {
start.value = performance.now()
},
onResponse({ request, response, options }) {
const now = performance.now()
if (start.value) {
time.value = start.value - now
}
},
}

return { start, time, fetchOptions }
}
import { useFetch } from 'nuxt/app'
import { ref } from 'vue'

export const useFetchTime = () => {
const start = ref<DOMHighResTimeStamp | undefined>()
const time = ref<number | undefined>()

const fetchOptions: Pick<NonNullable<Parameters<typeof useFetch>[1]>, 'onRequest' | 'onResponse'> = {
onRequest({ request, options }) {
start.value = performance.now()
},
onResponse({ request, response, options }) {
const now = performance.now()
if (start.value) {
time.value = start.value - now
}
},
}

return { start, time, fetchOptions }
}
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
useFetchTime.ts and yes, export const useFetchTime => ...
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
Yea I get a 500 error when trying to use the function exported from a file in my ~/server/utils dir
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
hmm, no it does not auto import, let me try to remove my custom imports dir setting and module and double check
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Auto import server utils
Yea I've looked at that, as far as I can tell it doesn't say anything about importing for the utils ddir
22 replies
NNuxt
Created by bnason on 8/23/2024 in #❓・help
Fetch load time
Mostly I was wondering if there was some underlying fetch result that might include that already
5 replies