Appifio Creator · Lesson EM09 · Easy Storage
example · checklist · don’t mix with Aura
One loop: create a post → route → detail page. Then a pre-delivery checklist.
Prerequisites: EM01-EM06 · page file blog/detail.html already exists (EM05)
Important - Prompt & Skills
Turn on: Appifio Easy Storage - Complete AI Guide (Prompt & Skills → Appifio prompt template). The agent already has the skills - you don’t need to paste docs.
Do not also enable Appifio Aura Storage (Advanced) - Complete AI Guide at the same time.
1. Create a post (read → edit → write → route)
async function createBlog(title, author, content, tags = [], category = 'Uncategorized') {
await window.waitForAppStorage?.();
let blogIndex = { blogs: {}, metadata: { total: 0, last_updated: '' } };
const result = await appifio_client.appifio_readFile('blog.json');
if (result?.success && result.data?.exists && result.data.content) {
try { blogIndex = JSON.parse(result.data.content); } catch (e) {}
}
const blogId = Date.now().toString();
const slug = appifio_client.appifio_generateSlug(title);
const now = new Date().toISOString().slice(0, 19).replace('T', ' ');
blogIndex.blogs[blogId] = {
id: blogId, title, slug, author, content,
tags, category, created_at: now, updated_at: now
};
blogIndex.metadata.total = Object.keys(blogIndex.blogs).length;
blogIndex.metadata.last_updated = now;
const save = await appifio_client.appifio_writeFile(
'blog.json',
JSON.stringify(blogIndex, null, 2)
);
if (!save.success) throw new Error(save.message);
// REQUIRED - without a route the post URL = 404
await appifio_client.appifio_addRoute(slug, 'blog/detail.html', 'blog');
return { success: true, blog: blogIndex.blogs[blogId] };
}2. Detail page (blog/detail.html)
document.addEventListener('DOMContentLoaded', async () => {
await window.waitForAppStorage?.();
const slug = appifio_client.appifio_getRouteSlug();
const r = await appifio_client.appifio_readFile('blog.json');
if (!r.success || !r.data.exists) {
document.body.innerHTML = 'No posts yet.
';
return;
}
const data = JSON.parse(r.data.content);
const post = Object.values(data.blogs || {}).find(b => b.slug === slug);
if (!post) {
document.body.innerHTML = 'Post not found.
';
return;
}
document.getElementById('title').textContent = post.title;
document.getElementById('date').textContent =
appifio_client.appifio_formatDateTime(post.created_at, 'date');
document.getElementById('content').innerHTML = post.content;
});3. Delete a post - remember to remove the route
async function deleteBlogBySlug(slug) {
await window.waitForAppStorage?.();
const r = await appifio_client.appifio_readFile('blog.json');
if (!r.success || !r.data.exists) return;
const data = JSON.parse(r.data.content);
const id = Object.keys(data.blogs).find(k => data.blogs[k].slug === slug);
if (!id) return;
delete data.blogs[id];
data.metadata.total = Object.keys(data.blogs).length;
await appifio_client.appifio_writeFile('blog.json', JSON.stringify(data, null, 2));
await appifio_client.appifio_removeRoute(slug);
}4. Pre-delivery checklist
Detailed method cards (AM-style) live in: EM03 (15) · EM04 (5) · EM05 (7) · EM06 (3) · EM07 (helpers) · EM08 (1)
- Backend = Easy + already clicked Save changes
- Every JSON
readFileusesJSON.parse+ try/catch; default structure when the file is missing (EM02) readField: checksuccess- don’t assume Aura’svalue: null(EM03)- One data type = one JSON file
- Every URL beyond home: HTML file +
addRoute(EM05-EM06) - Delete content →
removeRoute - Navigation links use absolute URLs (EM06)
- Secrets only via Secrets manager / server functions (EM08)
- Don’t copy
appendData/readList/ skip-parse from Aura; don’t build AM06-style admin login
5. Easy vs Aura - quick recall
| Topic | Easy | Aura |
|---|---|---|
| Lists | Edit the array yourself + writeFile | appendData / readList / updateData |
readFile | String → parse | Already an object |
| Built-in admin | None | Login / session |
| Full CMS | Usually not enough | Needs Advanced |
Details: BR02 · choosing the tab: F01.
Easy series complete
Back to EM01 for the map · or F01 / BR02 if you’re choosing Easy vs Advanced
Internal navigation (same language)
Appifio Creator · User guide · EM09