hino / mirage / config.js
config.js
Raw
export default function() {
  this.namespace = '/api';

  this.get('/business-trip-categories','businessTripCategory');
  this.get('/cost-centers','costCenter');
  this.get('/departments','department');
  this.get('/grades','grade');

  this.get('/news-and-informations','newsAndInformation');

  this.get('/travel-applications', 'travelApplication');
  this.get('/travel-applications/:id', (schema, request) => {
    return schema.travelApplications.find(request.params.id);
  });
  this.post('/travel-applications', (schema, request) => {
    var params = JSON.parse(request.requestBody);
    var db = schema.db;
    var result = db.travelApplications.insert(params);
    return schema.travelApplications.find(result.id);
  });
  //this.post('/travel-applications');
  this.put('/travel-applications/:id');
  this.patch('/travel-applications/:id', 'travelApplication');
  this.del('/travel-applications/:id', 'travelApplication');

  this.passthrough();
}