Answer the question
In order to leave comments, you need to log in
How to make dynamic routing with two parameters?
Objective:
1. Have a URL like: /books/tolstoy
2. In Express.js, have this path be processed through two dynamic variables: /:section/:author (for example)
Option: /what/:section/who/:author is not suitable .
How to do it? Make CNC. In PHP, I remember this was done through .htaccess.
Answer the question
In order to leave comments, you need to log in
Understood.
The error was as follows:
1. Styles were loaded like this 'styles/style.css'
2. And the inclusion of statics was like this: app.use(express.static('resources'))
Solution:
1. Styles like this: '/static/styles /etc.css'
2. Static like this: 'app.use('/static', express.static(__dirname + 'resources', {fallthrough: false}))'
Reason:
As I understand the styles were pulled to the address immediately after the first /, so they were loaded incorrectly. By specifying a specific folder, this problem is gone.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question