D
D
Dmitry2020-04-25 14:32:37
Web development
Dmitry, 2020-04-25 14:32:37

How to create your own page url?

Good afternoon, tell me how you can create your page address. That is, the user enters his url address in the input field (for example: domain.com/what the user entered) and this will be a unique page with his address

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daria Motorina, 2020-04-25
@glaphire

Within the same domain - the relative url of the page is just an identifier that is stored in the database on the backend, and then based on this identifier and the data associated with the user, the page is generated on the backend.
For any domain, such a task is not feasible.

A
Andrew, 2020-04-25
@AndrewRusinas

Do you know about Vue Router?) Is it not suitable for this task for some reason?

const rotues = [
  {
    // :user_input = "то что ввел пользователь"
    path: '/:user_input',
    name: 'UserPage',
    component: UserPage
  }
]

Inside the UserPage component, you can access the router object and get the 'user_input' parameter in one of the hooks in order to make a request for a backend and get data about the user.
created() {
  const user_input = this.$route.params.user_input
  this.$api.getUser(user_input)
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question