I struggle to make a REST querry from React Frontend, but is very hard to do it with only several documentation snippets. Could you help me with an example, please?
In services.ts I added this service (based on session_planner example):
If you’ve already created this file and added exposed service method there, can you provide contents of rest-services.xml and service method signature from service interface?
package com.company.sessionplanner.service;
import org.springframework.stereotype.Service;
@Service(AddService.NAME)
public class AddServiceBean implements AddService {
public int addMethod(int a, int b){
return a+b;
}
}
I do not call http://localhost:3000 in Postman. I just see the console.log() - F12.
Can you please help me with an example application (frontent Cuba Rest js and General (Add-on)Cuba Rest), please?
Or debug this (my) example…I want to display something in frontend via backend middleware.
Very good observation.
On port 3000 I have 404 Error (Not found) and on 8080/app-front I have 401 Error ( Unauthorized) - I thought they are the same.However, I found out from this topic Generic REST API changed? - CUBA.Platform that you change somehow Rest Add-on and now shoud I use Base64 with client and password etc.
Can you tell me how can I get acces to backend?
If you do not designate the service method as available for anonymous (e.g. <method name="addMethod" anonymousAllowed="true">) you should log-in user first. Here is a brief example: