React app routing with express server - node.js

I am making react app and I want to use express server for backend because I want to have user authentication and registration.
So is it reasonable to create couple of "apps" signIn, signUp and general app where user data is displayed. If yes how is it possible to route these different apps for express server? As I have understood is that express serves only index.html of react and browser makes the rest necessary file requests.

Related

res.cookie wouldn't set on my server-side app which deployed on Heroku

I have actually 2 apps one of react app and the other is the express app. When I try to send a request from my local React app to my express app which is on the server, it doesn't set a cookie for a response. Can anyone help me?

Pass through NextJS frontend requests to NextJS API first and then to Rails API or directly to Rails APi?

I am developing an App which consists of a NextJS frontend and a Rails API backend.
There is this /api route from NextJS where I can put "server side code".
Should I use this feature by sending my frontend requests first to that /api endpoint and then to the Rails API endpoint or is "ok" to directly send the requests to the Rails API endpoint?
For me that looks a bit like a "jump around the corner".
Are there true benefits using the NextJS frontend -> NextJS API -> Rails API approach?
No
From next js docs:
Use Cases
For new projects, you can build your entire API with API Routes. If
you have an existing API, you do not need to forward calls to the API
through an API Route.
Some other use cases for API
Routes are:
Masking the URL of an external service (e.g. /api/secret instead of https://company.com/secret-url)
Using Environment Variables on the server to securely access external services.
https://nextjs.org/docs/api-routes/introduction#use-cases
https://nextjs.org/docs/api-routes/introduction#use-cases

How to secure Angular (accessType- Public) and Nodejs app (accesType- bearer-only) with keyCloak

i am trying to integrate keyCloak in my application, i have created a Realm name "my-app" and added 2 clients
frontend (accessType -public)
backend (accessType - bearer-only)
I want to use the access token (returned from frontend client) to authenticate backend APIs.
i want to achieve same thing explained in this tutorial by making use of Roles, Client Scopes and mappers but not working for me
https://medium.com/devops-dudes/secure-front-end-react-js-and-back-end-node-js-express-rest-api-with-keycloak-daf159f0a94e
i made a mistake in configuration,
on frontend side i made url for auth server "http://127.0.0.1:8080/auth" and on Server side it was "http://localhost:8080/auth", else everything was correct

How to handle session management for application using Angular and Express

I am using Angular4 app for UI and I have a separate Node+Express app which handles rest api calls.
Angular app runs on a different port. and express app runs on a different port.
I try to use express-session framework on the server(express)app.
I use Microsoft ADAL services to authenticate the user. After successful authentication my approach was to make a rest api call from angular app to express server app by passing userEmail and set userEmail variable to req.session.userEmail. I expect the session to be available when a different route is being called to check if the session is available, but the session variable is always showing up as undefined.
What is the best solution here? My goal is to have a session management and prevent responding to unauthorized requests on the server side rest api calls.

Load data into ExtJS app at loadtime

I have a database of users and their security credentials. I'm using passport (node authentication middleware) to authenticate users before serving my main ExtJS app.js. Is there a way to configure my app.js with the user's security credentials as I'm serving app.js? I.e, if Bob is authenticated with security clearance 4, how can I configure my Ext JS app to reflect this security level? I'm quite unfamiliar with web programming..(but learning!)

Resources