CookCLI icon indicating copy to clipboard operation
CookCLI copied to clipboard

Recipes don't seed when running `make dev_server`

Open SkepticMystic opened this issue 1 year ago • 3 comments

I want to get started understanding and contributing to Cooklang. Just looking around the codebase for now, and trying to get the dev_server running for the ui. Everything builds and runs fine, but there aren't any recipes listed. Digging a little, I see that make dev_server runs the seed script, so I assume there should be some recipes on the ui? I've tried to find where they would be placed by default (base_path), but couldn't figure that out. Can you point me in the right direction?

SkepticMystic avatar Mar 09 '24 16:03 SkepticMystic

Yep, there should be recipes in UI when you run dev setup. They are stored in ./seed directory of the repo. When cargo run server ./seed & runs it uses that last argument to locate recipe files (and it's not a script, just a path to recipes for server command).

dubadub avatar Mar 10 '24 10:03 dubadub

Right, ok. I do see seeded recipes in ./seed. When I visit the local ui app, the html loads fine. But the request to /api/recipes returns HTML, not JSON, so a JSON parsing error is thrown in the console, and no recipes show.

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset='utf-8'>
	<meta name='viewport' content='width=device-width,initial-scale=1'>

	<title>Cook</title>
	<link rel='stylesheet' href='/vendor/bootstrap/css/bootstrap.min.css'>

	<link rel='icon' type='image/png' href='/favicon.png'>
	<link rel='stylesheet' href='/build/bundle.css'>

	<script defer src='/build/bundle.js'></script>
</head>

<body>
</body>
</html>

It's making the request to http://localhost:33689/api/recipes, not port 9080 where the I guess the cook server is running. Even though the rollup proxy is set

SkepticMystic avatar Mar 10 '24 15:03 SkepticMystic

Another method I found to work is using cargo run -- server which will build and run the server from the project root. The server will crawl recursively, so you should see a "seed" directory on the home page.

TheMagicNacho avatar Jul 07 '24 13:07 TheMagicNacho