-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to use both svelte-kit dev
and wrangler pages dev
?
#7
Comments
Check out the dev branch: https://github.com/lukeed/pages-fullstack/tree/dev it was the best melded solution I could come up with |
Cool. Do you just use |
It’s watch only. Not the same DX as dev but it gets the job done. Use dev for quick development for things like ui/styling and then watch to make sure it actually works lol. It’s kinda rough hence not being main branch |
I'll give it a try and at least provide feedback. Thanks. |
Np, closing as there's not much else that can be done here w/o directly affecting either tool |
Finally got around to trying this but can't figure out how to expose KV and Durable Object namespaces to my endpoints and test them locally. Any help would be appreciated. |
There's some recent discussion but the local dev story isn't looking great I think you could use the API when local and grab stuff that way, maybe At least I can now get at KV when in Pages – I think some things needed to get sorted first: /**
* @type {import('@sveltejs/kit').RequestHandler}
*/
export async function get({ params, platform }) {
let yerData = null;
let someOtherDataObject = {};
let KV = null;
// https://github.com/sveltejs/kit/tree/master/packages/adapter-cloudflare#environment-variables
if (platform?.env?.YOUR_KV_NAMESPACE) {
KV = platform.env.YOUR_KV_NAMESPACE;
yerData = await KV.get('some_sort_of_key'); // returns null if ain't none
}
if (yerData) {
someOtherDataObject = someMagic(yerData);
}
if (KV && someOtherDataObject) {
KV.put('some_other_key_maybe', JSON.stringify(someOtherDataObject), { expirationTtl: 2629746 }); // 1 month expiration
}
return {
body: someOtherDataObject,
};
} |
I'd love to be able to use both
svelte-kit dev
andwrangler pages dev
. I've triedbut that doesn't proxy the assets or the api correctly.
I'm about to try to launch them separately and sense that the cloudflare services are local, but I thought I'd ask first here in case someone has already figured this out.
The text was updated successfully, but these errors were encountered: