#LoaderAction Function

1 messages · Page 1 of 1 (latest)

simple jackal
#

You need to at least use a library to connect to the database and send a query

#

Or you can try to do what those libs do but I don’t recommend you to do that

steel narwhal
#

Hi, thank you for the response. Do you recommend any library?

#

or is there any remix example I can check regarding this? That would be more appreciated. 🙌 ❤️

simple jackal
#

I know this one https://www.npmjs.com/package/mysql2 but it hasn’t received an update in a long time

steel narwhal
#

Ohh cool.. I will check this. Thank you.

simple jackal
#
#

The latest release of that one is from 2 months ago

steel narwhal
#

Yep.. I will check this. Thank you so much @simple jackal ❤️

steel narwhal
#

Hello @simple jackal follow up question. Do you think it's a good idea to use Remix as your main Backend? I have Pure React frontend.

#

If yes, could you please explain why? If not, do you mind what do you recommend is the best practice? Thank you so much.

gilded lily
#

@steel narwhal In my opinion, we can use remix as a fullstack framework which means supporting your question. But anyways using a single codebase/framework for backend and frontend comes with it's cons such as maintaining the large project etc. If you're project is small enough to handle things from any point you can go with remix. I suggest you have a monorepo with any backend stack you can think of and use remix as a fully frontend tooling.

Either way if you love serverless and want to use platforms like vercel etc, go for remix it's the best of best to support serverless and frontend. It's just my opinion of using remix in different context.

simple jackal
steel narwhal
hard pasture
#

@simple jackal do you think that remix as a backend will catch up in ergonomics / community togetherness and eventually be the better option?

simple jackal
#

Remix uses Express only when you use the Express adapter and the Remix App Server

#

If you deploy to Vercel or Netlify or Deno or Cloudflare there’s no Express

simple jackal
hard pasture
#

solid point

#

Do you think that a lot of the functionality of remix will move towards the direction of more standardized backend support stuff? There's a part of me that feels like proper controllers with HTTP method's and middleware, is really all that Remix would need to feel pretty ergonomic as a backend for most backend devs making REST API's.

simple jackal
#

Yeah, loader and actions and controllers

#

And React is the view

#

Remix don’t give you a model plus other services you may need

#

I hope Remix keeps adding more Frontend and Backend stuffs eventually

#

Like a mailer, background jobs, websocket server, validations, etc for backend and animations, UI components for common patterns (reach ui?) and more for Frontend

steel narwhal
simple jackal
#

Remix is built to work as a request handler inside another server

#

if you use the Vercel adapter for example there's no Express, Remix integrates directly with Vercel

#

same with Cloudflare or Deno or Netlify

#

you could even build an adapter to integrate Remix directly into the Node http module without using Express

#

this is what allows Remix to be deployed basically everywhere even on different JS runtimes

#

it could be possible to run Remix inside a service worker too technically

simple jackal
simple jackal
#

you can install an ORM like Prisma

steel narwhal
#

Ok.. So it will go down to ORM or as you suggest I can use library for my selected db.

woven oar
#

@steel narwhal it's not hard to do it yourself. Maybe you can show what u have done so far? And we can try to guide you from there.