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

347
Vistas
In the mocking library miragejs is there a way to change the id that mirage auto assigns to be called e.g. "product_id", and not "id"?

The following function, makeServer should successfully seed the mirage database such that console.log(server.db.dump()); will return { id: '1', name: 'Test Product' }.

a) is there a way to change the default name of "id" mirage uses for a given model to something else, e.g. "product_id"? (In e.g. postgresQL the id column does not need to be called "id"). b) if there is, is this a bad idea for some reason?

I have read the 'db', 'model', and 'server' sections of the API docs and haven't been able to find this. At the moment I am passing the data around with "product_id" and if I can't alter mirage I will have to alter that in order that it will return product entries that the requests it is intercepting will accept.

import { createServer, Model } from "miragejs";

export function makeServer({ environment = "test" }) {
  return createServer({
    environment,

    models: {
      product: Model,
    },

    seeds(server) {
      server.create("product", { name: "Test Product" });
    },
  });
}
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