首页 > 解决方案 > 如何理解 Reactjs 中用于从服务器获取数据的端点

问题描述

我是 Reactjs 的新手,用于获取 api。端点从服务器 192.34.55.55:4000 向我分享后端开发人员,向我展示许多我无法正确理解的端点,我使用令牌获取一个用于登录请求,当我登录重定向时出现问题到像用户这样的私人页面,现在后端开发人员说我使用令牌句柄请求保护 api,但显示错误 400 错误请求错误等。请告诉我如何处理端点,我在互联网上搜索了很多次但找不到正确的答案满足我的要求。

告诉我端点是如何工作的以及我如何在 reactJs 中获取它?

Available routes
      session_path  POST    /api/sign_in             FuelUpWeb.SessionController :sign_in
   technology_path  GET     /api/technologies        FuelUpWeb.TechnologyController :index
   technology_path  GET     /api/technologies/:id    FuelUpWeb.TechnologyController :show
   technology_path  POST    /api/technologies        FuelUpWeb.TechnologyController :create
   technology_path  PATCH   /api/technologies/:id    FuelUpWeb.TechnologyController :update
                    PUT     /api/technologies/:id    FuelUpWeb.TechnologyController :update
   technology_path  DELETE  /api/technologies/:id    FuelUpWeb.TechnologyController :delete
        sport_path  GET     /api/sports              FuelUpWeb.SportController :index
        sport_path  GET     /api/sports/:id          FuelUpWeb.SportController :show
        sport_path  POST    /api/sports              FuelUpWeb.SportController :create
        sport_path  PATCH   /api/sports/:id          FuelUpWeb.SportController :update
                    PUT     /api/sports/:id          FuelUpWeb.SportController :update
        sport_path  DELETE  /api/sports/:id          FuelUpWeb.SportController :delete
     national_path  GET     /api/nationals           FuelUpWeb.NationalController :index
     national_path  GET     /api/nationals/:id       FuelUpWeb.NationalController :show
     national_path  POST    /api/nationals           FuelUpWeb.NationalController :create
     national_path  PATCH   /api/nationals/:id       FuelUpWeb.NationalController :update
                    PUT     /api/nationals/:id       FuelUpWeb.NationalController :update
     national_path  DELETE  /api/nationals/:id       FuelUpWeb.NationalController :delete
international_path  GET     /api/internationals      FuelUpWeb.InternationalController :index
international_path  GET     /api/internationals/:id  FuelUpWeb.InternationalController :show
international_path  POST    /api/internationals      FuelUpWeb.InternationalController :create
international_path  PATCH   /api/internationals/:id  FuelUpWeb.InternationalController :update
                    PUT     /api/internationals/:id  FuelUpWeb.InternationalController :update
international_path  DELETE  /api/internationals/:id  FuelUpWeb.InternationalController :delete

标签: reactjsendpoint

解决方案


推荐阅读