Hello everyone, I’m currently working on the time-stamp micro-service back end project and I’ve hit a snag.
I know it would be a lot easier to not use any front-end framework for the landing page, but I’m trying to get some practice with Angular v1.
I’ll start by saying that my front-end and back-end are not in the same file structure, and are not going to be on the same server as I’ve read that it is a good practice to separate front and back-end code. My back-end (node + express) is on Heroku and I plan on deploying the front-end to surge.
Here’s the problem I’m having; when I type the complete URL into the address bar in my browser a “cannot get /someNumber” error appears. I’ve spent the last day and a half working on this with no luck.
Things to note:
-
- I know a get request to ‘/’ works fine because I do receive the proper view in my browser.
-
- My api is “RESTful”, so I am only sending back json responses. The problem with this is that some of the solutions for the problem I’m having say to make a get’/*’ route in express and redirect all traffic to index.html. However since my html document and my express files aren’t on the same server, I can’t figure out how to do that (if it’s even possible?).
-
- I can get the proper response from the server if I type “/#!someNumber” into the address bar, however the instructions for the project say that the URL should only accept “/someNumber” with no #!.
-
- I’ve tried using $location in the controller to grab the URL then modify it, but no luck.
What would be the best way to go about solving this? The next step I was going to try was to create an interceptor or use transformRequest to grab the URL (which would be in the form of ‘/someNumber’,) and change it to ‘/#!someNumber’ before sending it to the server.
Or maybe I’m going about this all wrong. Any help would be appreciated! Thanks!