Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
![](/static/devrant/img/pipeless-devrant-banner-white.png)
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
plusgut60377yYou have a different devserver then you have in production, don't you?
For all the paths the server should respond with the same files as in /
If you don't want to make a request to the server each time the user clicks a link, you should use history.pushState -
@plusgut it is not making request while clicking links or change of state. Only url is changed....Say origin/ to origin/user. But it makes request when I visit origin/user directly either directly or by reload when state is origin/user. This makes me sick. Server respond as usual ... Cannot get /user
-
plusgut60377yYes obviously, how would the browser know it should use the html from / but not from /user?
Your server has to respond for every route the same as /.
And then your vue router can do his stuff. -
But in case of development server, it simply routes the single page application, to the page as specified by the route path. I mean it handles request to /user on its own.
So, did I fucked up something in production or "development server looks after this behaviour and routes according to for us and it's normal to see such differences in our production backend server" -
Do I need to place a handler in my prod. Server and route each request to / and then also set up a way for front end to know which component to trigger to view?
-
So say ...When I visit /user .... Server will route this request to / and also tells front end application to route SPA to /user
-
plusgut60377y@jalebiBhai no redirect should happen, just a simple 200 with the same content as the root route. Else you would loose your path and the vue router would show the /
-
@plusgut because I wrote backend, when I was writing in vanilla. So the state of url was not changing. The view changes, the state of application changes with request but not the url
-
One more thing. I have to make CORS from my dev server to production server to fetch data. I had configured the prod. server to accept CORS but it's not sending empty response. No json Data
-
plusgut60377y@jalebiBhai the browser useses the http method OPTIONS to get the cors informations from the server, to determine if it is allowed to make the actual request.
-
plusgut60377y@jalebiBhai I'm talking about the headers at the options response https://developer.mozilla.org/en-US...
-
Only for methods other than get and post, browser sends preflight request before sending actual request
-
plusgut60377y@jalebiBhai does the browser console say anything? What happens wjhen you do a request via curl?
I am creating a PWA using quasar, which uses vue.js at core.
Now the router is working fine. In production code, The address url is updating dynamically upon clicking route-links. Say, there are 4 routes, namely /user , /friends, /human, /robots. But when I visit one of those route paths using web address or say I reload the application/web page, when the route path is /robot or any other path, server reply with cannot GET /[route path]. I know that I had not set up the route handler at server, but I am not expecting this behavior. I dont want to make request to server like this.
While in dev mode, everything is working fine and as expected. when I visit /robot or any other route path , instead of contacting the server, it render the component that was bound to handle that route path
question
vue-router
nodejs
quasar
routing
route paths
vuejs
javascript