Kalil
Kalil
Explore posts from servers
WWasp-lang
Created by Kalil on 8/23/2024 in #đŸ™‹questions
Simple File Upload
Nice
12 replies
WWasp-lang
Created by Kalil on 8/23/2024 in #đŸ™‹questions
Simple File Upload
The other frameworks solutions (laravel, adonis etc) covers two or three things: 1. make the uploaded file easily accessible from the controller args withtout need to create a middleware Laravel example:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserAvatarController extends Controller
{
public function upload(Request $request)
{
$avatar = $request.file('avatar');
}
}
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UserAvatarController extends Controller
{
public function upload(Request $request)
{
$avatar = $request.file('avatar');
}
}
Adonis example:
import { HttpContext } from '@adonisjs/core/http'
export default class UserAvatarsController {
update({ request }: HttpContext) {
const avatar = request.file('avatar')
console.log(avatar)
}
}
import { HttpContext } from '@adonisjs/core/http'
export default class UserAvatarsController {
update({ request }: HttpContext) {
const avatar = request.file('avatar')
console.log(avatar)
}
}
2. Easily move files to a persistent location
await avatar.move(app.makePath('storage/uploads')
await avatar.move(app.makePath('storage/uploads')
3. Interfaces for easily persisting and serving files, where you can easily exchange the storage target (local, s3, etc) on a config file. Adonis provides Drive API and AttachmentLite API for that
12 replies
WWasp-lang
Created by Kalil on 8/23/2024 in #đŸ™‹questions
Simple File Upload
yeah, it solves the problem, but requires boilerplate. I think we should think about how to simplify that since it's a very common fullstack feature
12 replies
TTCTheo's Typesafe Cult
Created by Kalil on 7/23/2024 in #questions
Do I need `HydrateClient` on every Next.js route?
Ok
4 replies
TTCTheo's Typesafe Cult
Created by Kalil on 7/23/2024 in #questions
Do I need `HydrateClient` on every Next.js route?
Help?
4 replies