Closed s7dhansh closed 7 years ago
Hello,
Can you give a code example ?
In the demo itself (both master and develop branches), I replaced the
const NotFound = ({ location }, { router }) => {
if (Meteor.isServer) {
with
const NotFound = ({ location }, { router }) => {
console.log(1, location);
if (Meteor.isServer) {
in the imports/routes/NotFound.jsx
file.
Now when I go to http://localhost:3000/anything?abc=1, it prints
1 { pathname: '/login1', search: '', hash: '' }
on the server, but
1 Object {pathname: "/login1", search: "?abc=1", hash: "", state: undefined, key: undefined}
on the client.
Ha okay.
It's normal. You need to whitelist url parameters server side.
See this file : https://github.com/ssrwpo/ssr/blob/master/demo/server/urlQueryParameters.js
Oh great! My bad for not checking the demo out properly. The format is a bit changed in the develop
branch, but it works.
Cool! Have a great day :)
How to get the query parameters from the url on the server? The
props.location.search
parameter is always blank on server.