404 not found while designing a loopback API

26 Views Asked by At

I might sound naive. I have been trying to fetch the data by 'name' as we do by an Id. Have ben getting this error 404. A keen look into it will be quite helpful, thanks.

// Fetch by Name.

  @get('/loop/connection-saves/{connection_name}')
  @response(200, {
    description: 'ConnectionSave model instance',
    content: {
      'application/json': {
        schema: {
          type: 'array',
          item: getModelSchemaRef(ConnectionSave, {includeRelations: true}),
        },
      },
    },
  })
  async findByName(
    @param.path.string('connection_name') connection_name: string,
    @param.filter(ConnectionSave) filter?: Filter<ConnectionSave>,
  ): Promise<ConnectionSave[]> {
    const filteredFilter: Filter<ConnectionSave> = {
      ...filter,
      where: {
        ...filter?.where,
        connection_name: connection_name,
      },
    };
    return this.connectionSaveRepository.find(filteredFilter);
  }

[[enter image description here](https://i.stack.imgur.com/PMx7g.png)](https://i.stack.imgur.com/yCyzo.png)

0

There are 0 best solutions below