Open rglover opened 2 years ago
This is just big enough of a pain in the butt that Joystick should pick up the weight. Just do something like...
import joystick, { sitemap } from '@joystick.js/node'; joystick.app({ routes: { '/sitemap.xml': async (req = {}, res = {}) => { sitemap(res, { static: [ { path: '/' }, { path: '/about' }, { path: '/terms' } ], dynamic: [ ...( (await process.databases.mongodb.collection('posts').find().toArray())?.map((post) => ({ path: `/posts/${post.slug}`, lastModified: post?.updatedAt })) ) ], }); }, } });
Idea above is that objects are taken in and mapped over to the appropriate XML format and the res object has the appropriate Content-Type set.
res
Content-Type
Maybe do this as res.sitemap() so it's even easier?
res.sitemap()
This is just big enough of a pain in the butt that Joystick should pick up the weight. Just do something like...
Idea above is that objects are taken in and mapped over to the appropriate XML format and the
res
object has the appropriateContent-Type
set.