Build a better mousetrap
Last updated
Last updated
$ cd ~/workspace/loopback-zero-to-hero/
If we inspect server/datasources.json
out-of-the-box (OOTB), we should see that a memory database is in use as a mock placeholder of sorts. This is done so we may develop our application logic without worrying about the backend too early.
Let's build a better mousetrap! Errrrr... database, Let's build a better database.
|||topic
Read official docs on |||
Using a file to back the memory DB has significant advantages.
We can look at what's going on behind the scenes by simply peeking into a json file
We don't lose all our data on every restart.
So let's edit server/datasources.json
by adding a line "file": "db.json"
to it:
Fire up the server: node .
Project > Box Info
Open a browser window: http://<box-name>.codio.io:3000/explorer/
The Users
api will be ready to explore OOTB.
Use /POST Users
from the explorer UI to create a user:
Use that as the json body and then click the Try it out!
button.