RodrigoBertotti / flutter_chat_app_with_nodejs

A Flutter Chat App built with Node.js, MySQL, and WebSockets.
MIT License
73 stars 29 forks source link

Just Get the Chat Part #5

Closed murat889 closed 7 months ago

murat889 commented 7 months ago

Hello, I just discovered your package, installed it and found that it works very well. But I need your opinion to make an edit. I am making a new application, the general parts of the application are ready, I just want to use your package for the messaging part. I have my own membership system and database. How can I remove the login and registration section in your package and integrate my own member list? Which are the fields where I can change UserId and other parts?

RodrigoBertotti commented 7 months ago

Hello, thanks! So you will have two backends:

Host nodejs_websocket_backend separated from your existing backend project.

Follow all the instructions on Getting started section, and customize nodejs_websocket_backend/environment/db.ts to use your existing db. Don’t use production db for now ⚠️.

You may also want to customize the entities the way your db is designed on nodejs_websocket_backend/src/domain/entity.

So the Flutter App will no longer generate the token interacting with nodejs_websocket_backend, but interacting with your existing backend instead: Go to flutter_app/lib/features/login_and_registration/data/data_sources/auth_remote_ds.dart and change the code from getAccessTokenWithEmailAndPassword and also useRefreshTokenToGetNewAccessToken functions to call your existing API, so the code AsklessClient.instance…(something) will no longer exist inside these 2 functions.

On nodejs_websocket_backend/src/index.ts change the code from the authenticate(...) function and replace it with your custom token validation logic.