Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
How React works with Axios and DynamoDB

Please someone help me to understand this code. This is a part of the code for Fuse React which you can Google it. The problem, I can't figure out is to how save data to DynamoDB. Should I use Lambda to save to DynamoDB or this code is doing everything, and I just have to change the Axios Get URI? I don't get the path in the request:

await axios.get('/api/todo-app/todos'

Should I have an exact path on my api gateway? If yes, should I include api? or that means my api server URL?

Here is the default code without any change. Todo App sends a request via Axios:

export const getTodos = createAsyncThunk(
  'todoApp/todos/getTodos',
  async (routeParams, { getState }) => {
    routeParams = routeParams || getState().todoApp.todos.routeParams;
    const response = await axios.get('/api/todo-app/todos', {
      params: routeParams,
    });
    const data = await response.data;

    return { data, routeParams };
  }
);

And the mock api is receiving the request as following: Which I don't know should I copy this and paste it to Lambda? Or it's just a mock api and I dont need it at all If I use DynamoDB.

mock.onGet("/api/todo-app/todos").reply((config) => {
  const { params } = config;
  let response = [];
  if (params.labelHandle) {
    const labelId = todoDB.labels.find(
      (label) => label.handle === params.labelHandle
    ).id;

    response = todoDB.todos.filter(
      (todo) => todo.labels.includes(labelId) && !todo.deleted
    );
  } else if (params.filterHandle) {
    if (params.filterHandle === "deleted") {
      response = todoDB.todos.filter((todo) => todo.deleted);
    } else {
      response = todoDB.todos.filter(
        (todo) => todo[params.filterHandle] && !todo.deleted
      );
    }
  } // folderHandle
  else {
    let { folderHandle } = params;
    if (!folderHandle) {
      folderHandle = "all";
    }

    if (folderHandle === "all") {
      response = todoDB.todos.filter((todo) => !todo.deleted);
    } else {
      const folderId = todoDB.folders.find(
        (folder) => folder.handle === folderHandle
      ).id;
      response = todoDB.todos.filter(
        (todo) => todo.folder === folderId && !todo.deleted
      );
    }
  }

  return [200, response];
});

This seems like SO EASY to configure, But I have been working on it work 2 weeks and No luck!

Any explanation would be very helpful guys! thanks,

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda