Getting App Running
Once our database is configured, running the App is quite straight-forward.
But before that, let us take a quick look at index.js
makeServer()
#
Calling You can find the code below in your index.js
when you install the app.
import { makeServer } from "./server";
// Call make ServermakeServer();
It is intuitive that the server.js
must be exporting makeServer()
function, which is being called in the entry-point of our Frontend App.
In this way, the server and it's APIs are made available to the frontend.
Of course, you don't need to look more into what is inside the server.js
at the moment; and let us get our app running!
#
Running the AppThis step is the same as in all other CRAs. To run the app write the following command in your terminal
yarn start
This should run the app on localhost:3000
.
#
Important NoteSince this is a Mock-API, the data will not persist. Which means, the database operations performed such as create, update, delete etc. will vanish once the session ends.
mockBee is a great tool for making Personal Frontend Projects with multiple features without having to write real backend. But as said earlier, for real usable applications; you should consider setting up your backend with express, Django etc. frameworks.
#
Winding upKudos! You have successfully set up your mockBee React App ๐
Now, on top of this; you can start building your frontend as you like.
#
Next Steps- Using
fetch()
, now you can access the APIs for your respective app! Find API Documentation of your app here - Want to read more on the whys and hows of mockBee, miragejs, customization, available APIs and more? We have curated some Guides here
- Interested in exploring main concepts, how to add custom APIs and resources for learning miragejs?