Nodejs set up a station, how to identify pc and mobile access?

  node.js, question

The website should render different responses according to the access of the pc and the mobile terminal. How should the PC and the mobile terminal be recognized and jump accordingly? Is there also two view files?

There are two ways to distinguish between PC and mobile access to you:

  1. One page, automatic size
    Mainly throughmedia queriesCooperate with grid system to achieve different display effects under different screen sizes, and the responsibility for judgment lies on the front page.

  2. One content, two pages
    You can completely write out two different pages to be displayed on the PC side and the mobile side respectively, and the responsibility for judging the client type falls on the back end, which can be detected in the requestUser-AgentField, different browsers have different values.