nuxt-modules / nuxt-modules/strapi

Multi word with hyphen in API route as strapi entity

Open
#277 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
TypeScript
Stars
717
Forks
89
Avg merge
7h 3m
Merged PRs (30d)
6

Description

Wondering how to use a multi-word api route where there's a hyphen in the path

My case: I have a route called /press-releases, registered in nuxt.config.js under entities. I can't use this.$strapi.$press-releases in the application though, and didn't find a workaround to specify the URL path for an entity.

What's the right way to do this? If there's no way, it would be neat if snakeCasing did the trick.

Current setup:

# nuxt.config.js

strapi: {
    entities: [{ name: 'press-releases', type: 'collection' }],
    ...
}
# pages/press.vue

# JS can't handle this
this.$strapi.$press-releases.find() 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the entity configuration in nuxt.config.js and the failing usage in pages/press.vue, then trace how the configured entity name becomes a Strapi accessor. Confirm how a hyphenated route should be referenced and verify that finding the press-releases collection works through the supported API.

Written by the indexing model from the issue text.

Assessment

Tech stack
nuxtjs, typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.