realworld icon indicating copy to clipboard operation
realworld copied to clipboard

Cannot create new article

Open martimatix opened this issue 3 years ago • 3 comments

When I clone the repo and run it locally, I cannot create a new article. On the create article form, clicking on the "Publish Article" button disables the button and the form hangs. Developer tools says POST | http://localhost:3000/article.json was sent with the following response:

404

Not found: /article.json

Error: Not found: /article.json

Is something required in src/routes/article/index.json.js to send the form data to conduit.productionready.io?

martimatix avatar May 02 '21 11:05 martimatix

Yes. And there should be something returned in index.json.js or else it will be interpreted as a 404: https://kit.svelte.dev/docs#routing-endpoints

Here's how the old Sapper version worked: https://github.com/sveltejs/realworld/blob/5cd6db62bf8a5db69421f2568c25060054e8da8a/src/routes/editor/_Editor.svelte#L28 https://github.com/sveltejs/realworld/blob/5cd6db62bf8a5db69421f2568c25060054e8da8a/src/node_modules/api.js#L37

benmccann avatar May 02 '21 22:05 benmccann

I didn't get it. Is it a bug in the code or in the documentation? I haven't seen anything in the README about additional steps to make it work. I understood the purpose of this repo was to serve as a real world example. Isn't it?

fredguth avatar Apr 28 '22 13:04 fredguth

There is a bug. It looks like that code never got created when this project was migrated from Sapper to SvelteKit

benmccann avatar Apr 29 '22 17:04 benmccann