NubeBuster
Explore posts from serversTTCTheo's Typesafe Cult
•Created by NubeBuster on 5/30/2024 in #questions
Queryraw condition joining in Prisma
This question was also posted in the Prisma Discord but it's been a few days without replies. https://discord.com/channels/937751382725886062/1244937417493053440
I need to use a procedure and then filter on this from a sqlserver database. I am having some issues constructing a query that is dynamic and safe. Prisma.join is only for joining values, but how do I join conditions?
What makes it complicated is that the conditions are dynamic filters. Some some may be present or not.
Example
7 replies
PPrisma
•Created by NubeBuster on 5/28/2024 in #help-and-questions
Queryraw condition joining
I need to use a procedure and then filter on this from a sqlserver database. I am having some issues constructing a query that is dynamic and safe. Prisma.join is only for joining values, but how do I join conditions?
What makes it complicated is that the conditions are dynamic filters. Some some may be present or not.
Example
10 replies
TTCTheo's Typesafe Cult
•Created by NubeBuster on 3/1/2024 in #questions
Using uploadthing for serving static files
https://youtu.be/mi9IDtgS6hc?si=KKqLTxWOf9L6hf8Y&t=441
In this video Theo said that for serving static mp3 files uploadthing is a good option to prevent unnecessary bandwidth usage for the highly available cdn of vercel.
I've just uploaded my static mp3 files, which are loaded by every visitor, to uploadthing. Now I run into the problem that I have no way to list the files in order to use them. I am considering making a seperate node 'project' folder which I will use to upload the background video to uploadthing automatically when I run a script to process the files using ffmpeg. The current video files count 42 files in m4s format for streaming video. Now what would be a good way to automatically upload them and then be able to serve them like so:
The .mpd is the main file that AFAIK defines which files are part of the stream.
I consider writing the links for these files into a file in the /public/ folder of my next project so that it's accessible to the users. How would I then adjust my code to properly serve the files in a way that nextjs understands it?
2 replies
TTCTheo's Typesafe Cult
•Created by NubeBuster on 7/30/2023 in #questions
How does vercel run my code? Is my cache code working as intended?
You can use something for a long time yet not know what you're working with. I just came to a realization that something I am doing may not be correct:
This is one of my routers. It fetches data from an external source. The goal is to cache this data so I don't have to fetch it each time my clients send a request. But I am starting to understand that serverless stuff doesn't work that way...
I am using T3 and hosting on vercel.
Does this code make any sense? Or should I use something like redis for this?
3 replies
TTCTheo's Typesafe Cult
•Created by NubeBuster on 6/24/2023 in #questions
Continuous process while server is running
With NextJs my definition of a server is being challenged. I see a server as a program that can serve requests and do background tasks. With nextjs it seems to only do the former.
I have a web application where users can manage instances of a program on several machines. The machines run a kotlin program that manages the machine processes of the program instances locally. I want this kotlin program to communicate with the T3 server backend to listen for requests such as making a screenshot. I was thinking of doing this with a websocket.
When the user opens the /instances web page, they will see the running instances of the program on the machines. I want the user to be able to click on Screenshot button and then the backend notifies the kotlin programs that a screenshot needs to be made. The kotlin program makes the screenshot and then uploads it to the backend. Then the image can be served to the user.
If I put this in root.ts
this code runs each time a web page is visited or something. Instead I want this to be called when the T3 server starts and then keep running. Is that possible? Is that correct usage of NextJs? Should I take a whole different approach?
6 replies