I had tried that.
I tried -http://localhot:3000/getmejson ( full url ) and just "/getmejson". 
 Feels to me I am missing something big in MEAN app. May be some concept to 
incorporate. My front end get request is not caught by my backend. Both are 
in same project with front end in "client" folder. I build client code and 
run the app on 3000. 
localhost: 3000 => takes to me front end served index html. Button clicks 
captured and http.get called. I use HTTPClientModule( angular 4) . From 
there, it should be express backend getting the get call and sending to 
router. 

Included routers, body parsers, static directory and headers info and 
router for that route "/getmejson"

Did I need to use any other modules at any end? I am still learning and do 
not know design and coding practices with MEAN framework.



On Wednesday, August 23, 2017 at 4:37:49 PM UTC-4, Lucas Lacroix wrote:
>
> URLs use forward-slash, "/", and not back-slash , "\".
>
> So, using your example:
> http.get('/getmejson')
>     .subscribe((response) => {
>         console.log(response);
>     });
>
>
>
> On Wed, Aug 23, 2017 at 4:32 PM LJ <[email protected] <javascript:>> 
> wrote:
>
>>
>> Hi 
>>
>> I have angular front end with basic button click it triggers http get to 
>> express backend. I have router on the backend which takes the request and 
>> redirects to external server and gets back json data. 
>> Now my backend part was working fine until I added angular front end to 
>> it. 
>>
>> Ex, 
>> backend router takes request from browser  for url "\getmejson"  then 
>> http:\\localhost:3000\getmejson -> calls external server configured in 
>> backend itself for credentials, login etc + authenication headers and gets 
>> json.
>> JSON fetched printed on console.
>>
>> Now, I added front end code in angular 4 with service in TS, and other 
>> code etc. 
>> Button click calls basic 
>> http.get('sameURLhere') .subscribe(data=> {console.log(data)});
>>
>> I know console.log will not work since it is async request and I see 404 
>> returned. Browser trace is not very useful for newbie like me and I learnt 
>> for basic json fetching I do not need fancy and basic subscribe should work 
>> without implementing Observable. I want this request to be forwarded to 
>> backend router then to external server and data back to front end so I can 
>> render it.
>>
>> Please suggest. I may not be able to give full codes but basic structure 
>> if needed.
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Angular and AngularJS discussion" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/angular.
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Lucas Lacroix
> Computer Scientist
> Advanced Technology Division, MEDITECH <http://ehr.meditech.com/>
> 781-774-2293
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to