React apps in subdirectories that use React Router

If you’ve ever deployed your new React app to a subfolder on your server and you’re using React Router you might notice that React Router starts getting all funky and truncates the subfolder name.  This is the expected behavior, albeit something easy to overlook when deploying to a subfolder.  The good news is that there is a pretty straightforward solution: just add a basepath  to your Router and specify the folder name.

Check out the documentation.

For example, I deploy most of my playground apps to, to deploy the Auto9 app I use a subfolder and the resulting URL is

This is what my Router looks like for that app (keep in mind I import my routes from an external file).

Also, keep in the mind that you should have a “homepage” node in your package.json before you a do a build.

Using json-server for local mock API

I keep a boilerplate Rails 5 API-only app among my repos for rapid API building, but sometimes I just want a basic structure to query against (without having to deal with a complete stand alone Rails app).

Enter: json-schema-faker and json-server

Cory House has put together a great tutorial on how to build and serve a json database in 3 easy steps: