Skip to content
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

can't get the sveltekit update to work with this one #8

Closed
j2l opened this issue Mar 31, 2022 · 5 comments
Closed

can't get the sveltekit update to work with this one #8

j2l opened this issue Mar 31, 2022 · 5 comments

Comments

@j2l
Copy link

j2l commented Mar 31, 2022

Hello,
The project needs an update. I tried to find how to do it to PR but I didn't succeed since sveltejs/kit#3384 (comment)
Any idea?

@timsonner
Copy link
Owner

I'm going to look into this, I haven't done much with Svelte lately, so I need to dust off the cobwebs. Have you tried the Svelte discord channels? Someone there can probably assist more quickly than I, but I will see about getting this up and running, see what I find.

@j2l
Copy link
Author

j2l commented Apr 6, 2022

I didn't try discord.
I'm usually frustrated with it and StackOverflow 😄

@timsonner
Copy link
Owner

Latest and greatest. I have no idea what errors you encountered, but there have been breaking changes for sure. The primary change concerning this project is the RequestHandler. There is also the issue of having to remove the line "target" from svelte.config.js. I also ran 'npm upgrade' before doing anything. New import statement style as well. Got this running by hacking at my /src/routes/api/index.json.ts file, it looks like:

import { spawn } from "child_process"
/** @type {import('@sveltejs/kit').RequestHandler} */

let output: string = ``

function makeSystemCall(): void {
const systemCall = spawn(ls, [-al])

systemCall.stdout.on(`data`, (data) => {
    output += data
    console.log(`stdout: ${data}`)
})

systemCall.stderr.on(`data`, (data) => {
    console.error(`stderr: ${data}`)
})

systemCall.on(`close`, (code) => {
    console.log(`child process exited with code ${code}`)
})

}

// 04/06/2022 @ 2:30AM This looks to be the new way to make a request

export async function get() {

    makeSystemCall()
    return {
        body: output
    
}

}

@j2l
Copy link
Author

j2l commented Apr 6, 2022

I'll try ASAP!

@j2l
Copy link
Author

j2l commented Apr 6, 2022

Working, thank you @timsonner !
I only changed to body: { output } to get a valid object.
Fixed!

@j2l j2l closed this as completed Apr 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants