We’re wrapping up week 9 of #JustCode with a web app that demonstrates a web service, JSON and SQLite. The web app functions as both an app with a UI and a web service. It lets you enter your own quotes which are saved in a SQLite database. The web service randomly fetches a quote and returns it as JSON.
The SQLite database has just a single table called Quote with this structure:
CREATE TABLE Quote ( ID INTEGER NOT NULL, QuoteText TEXT, QuoteSource TEXT, PRIMARY KEY (ID) );
To randomly fetch a single quote from the table, this SQL is used:
SELECT QuoteText, QuoteSource FROM Quote ORDER BY RANDOM() LIMIT 1;
As companion apps, I’ve also included simple desktop and iOS apps that call the web service to display a quote.
The raw JSON that is returned looks like this:
{"QuoteText":"Simple things should be simple. Complex things should be possible.","QuoteSource":"Alan Kay"}
I’ve published a version of this on Xojo Cloud. Access the app.
Access the web service here.
You can download the projects or check it all out on GitLab.
Add your #JustCode project to the week 9 forum conversation.
Download and check out earlier projects:
- Week 8: JumpStart App Launcher
- Week 7: Pitch Tracker
- Week 6: Bubble Popper
- Week 5: Math Quiz
- Week 4: Mini-Golf ScoreKeeper
- Week 3: Dogs Up!
- Week 2: Password Generator
- Week 1: Color Picker