How can i add subdomain based views - reactjs

Hello Everyone!
Currently i'm working on a proyect where every customer can add it's store to add some services and stuff. Even when the view it's the same for all stores (obviously loading each store own data) i would like to create an url using as subdomain the store name like this.
Let's say the store name is : The Wolf
So the URL i would like it to have is : thewolf.mycustomdomain.com
I'm currently working on React js using react-router-dom so i would like to ask to this community if anyone knows how to make this happen.
Thanks in advance if anyone can give me some hints!

You can not create subdomains in react. You need to configure a proxy for it. You can look at this post for more information.

Related

How to Programatically create add new aws-cognito users in REACT

Is it possible to use React in order to programatically create new aws-cognito users and delete them? I know one can update with Auth.updateUserAttributes. Is there something similar for creating and deleting users like e.g Auth.updateCreateUser or something. If possible please include an example. Thanks!
This should be possible with Cognito JS SDK. See https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-integrating-user-pools-javascript.html
To delete the user take a look at https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminDeleteUser.html

Will admin on rest play nicely with cloudinary/postgres on the same tab?

Before i start looking down this road i have different datasources that would need to be updated in the same tab if i was to attempt to use react-admin, wondering if i'll be able to modify it to do what i need?
For anyone else who happened to land here and had as little experience as i did when i asked this.... you can use the cloudinary widget in your react-admin app and pass the returned url off to your mutation no problem.

2sxc - Getting URL path from DNN link parameter / Tab ID

I am working on integrating a 2sxc content WebAPI feed into a ReactJS application.
I have managed to get a JSON feed of data into the application, and am in the process of mapping out the data.
I'm wondering what the best practice would be to "resolve" a URL which is coming through as a DNN Page/ Tab ID.
Below I will showcase the various points this is referenced...
First the Setup of the entity / data types...
Then this is an example entry with the data filled out... The page link / URL is set up to point to another internal page on the DNN website:
Finally you can see this data item come through as a JSON feed via the 2sxc API:
What is the best way to convert this piece of data into a URL which can be used in a SPA type application?
There isn't any "server-side" code going on, just reading a JSON feed on the client side...
My initial idea would be to parse this piece of data in JS, to extract the number then use something like this:
http://www.dotnetnuke.com/tabid/85/default.aspx
http://www.dotnetnuke.com/default.aspx?tabid=85
I was hoping someone with more experience would be able to suggest a better / cleaner approach.
Thanks in advance
If you were server-side in Razor you'd be doing something like this:
#using DotNetNuke.Common
View List
XXXX = Dnn.Tab.TabID or define a string with the tab id you want
I seem to have a vague memory that I saw somewhere that Daniel (2sxc) has a way to use Globals.NavigateUrl() or similar on the client side, but I have no idea where or if I did see that.
The Default.aspx?tabid=xx format will certainly work, as it's the oldest DNN convention and is still used in fallbacks. The urls aren't nice, but it's ok.
The reason you're seeing this is because the query doesn't perform the automatic lookup with the AsDynamic(...) does for you. There is an endpoint to look them up, but they are not official, so they could change and therefor I don't want to suggest that you use them.
So if you really want a nicer url, you should either see if DNN has a REST API for this, or you could create a small own 2sxc-api endpoint (in the api folder) just to look that up, then using the NavigateURL. Would be cool if you shared your work.

generate static urls automatically in MEANjs project

I am working on a MEANjs project. Till now, the project consisted of dynamic urls, wherein the city and country name will get attached to the url and filters will attach as parameters, dynamically. But now, for SEO purpose, I need static urls with filters and city/country name.
Currently I have urls like this: www.abc.com/xyz/san-jose--ca--usa?params=123
I need to have static urls for the same as: www.abc.com/123-xyz-in-san-jose--ca--usa
So here are the problems I am facing:
1. I am not sure whether this has to done in backend(nodejs) or frontend(angularjs).
2. Whether I need to generate and store all such 1000s of url somewhere in my project.
3. if point 2 is true, do I need a list of all cities and countries to generate such urls? If so, how will I get those.
I tried to google, but I could only find something in php which is .htaccess and I am not even sure if its the same thing that I am searching.
Can somebody help me out or guide me to any documentation explaining the same?
Edit:
Since I need to use google maps geocode to get lat-lon for the city-state combo. For point 1, I am going the angularjs way. I can specify the routes similar to the way suggested by Molda in angularjs.
For point 2, I figured I will have to generate the static links for all city-state combinations and store it in some file. But I am not sure how to get all the city-state combination for USA.
As of now, I am going with census data. But again, not sure if google will geocode it correctly or not. If anybody can help me out in this, it will be awesome.

Loopback : How to get one model data from other mode service method?

I'm using loopback angular sdk I'm having two models Tags and Project. I want to get Tags related to that project. I'm having lb-services. I don't know what method to call and how to call it from services. please help. I've tried this code to get tags which is related to project who's id is 1.
Project.Tag.find(
{ id: 1 }
);
Here's an example from a live app ... For a relationship described like so:
https://github.com/ShoppinPal/warehouse/blob/490cbaccfb60922645173a34d53327629b989028/common/models/user-model.json#L28
I can pull the related models on the angular side like so:
https://github.com/ShoppinPal/warehouse/blob/dbf8d1e25592ec9e76d9f6a5f2af6ba6ca74fd9c/client/app/scripts/controllers/login.js#L57
If your problem is purely syntactical then please paste code from model.json file as well so the community can help detect & fix it.

Resources