I
I
Igor2020-02-15 03:50:01
Vue.js
Igor, 2020-02-15 03:50:01

CNC, Nuxtjs how to implement?

Colleagues, welcome.

Nuxtjs
SSR

I want to implement CNC on the site.

Scheme:

1 (http://domain.ru/voronez)
2 (http://domain.ru/voronez/avtoservis)
3 (http://domain.ru/voronez/avtoservis/diagnostica)


Data is loaded via API

Pre-created the following routes

export function createRouter() {
  const router = new Router({
    mode: 'history',
    routes: [
      {
        path: '/',
        component: Index
      },
      {
        name: 'organizations_city',
        path: '/:city',
        component: Organizations,
        props: true,
        beforeEnter: (to, from, next) => {
          next()
        }
      },
      {
        name: 'organizations_city_category',
        path: '/:city/:category',
        component: Organizations,
        beforeEnter: (to, from, next) => {
          next()
        }
      }
    ]
  })


If I go to domain.ru/voronez , then how will I load organizations, if I need to pass numeric values ​​​​in the API parameters.

The customer stomps his feet, saying that url domain.ru/organizations?city_id=4324 does not quote.
You need domain.ru/voronez.

CNC options fucking cloud planned
In the database of 5 ml of organizations and 3000 cities + 1200 category

http://domain.ru/город/категория/услуга

How to get out of this situation.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2020-02-15
@IgorPI

Well, you have / will have some kind of database with all the cities, their ids and names. If it is possible to rewrite the server - make it so that in addition to the id it can accept the name of the city.
If not, you can make an additional api point passing the name there, and get the id.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question