-
Notifications
You must be signed in to change notification settings - Fork 79
Implement a minimal server #576
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
Conversation
@@ -8,7 +8,7 @@ import Node.Encoding (Encoding(..)) | |||
import Node.FS.Aff as FS.Aff | |||
import Node.Path as Path | |||
import Registry.Manifest as Manifest | |||
import Test.Assert as Assert | |||
import Registry.Test.Assert as Assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is because Test.Assert
is already a well-known module, and this rename avoids conflicts.
} | ||
|
||
createServerEnv :: Aff ServerEnv | ||
createServerEnv = do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all information we want to persist from request to request.
This is great! 👏 As I mentioned in #578 (comment) could we switch to |
Sure — in fact, I originally used |
Just leaving this as a note for myself — npmlock2nix now supports package-lock v2 formats (which we use), and purescript2nix looks like it will support our repository setup with spago.yaml, so I can now nixify the build way more easily. |
You mean direct access to httpurple? if so, happy to give you access |
This PR implements a server for the registry using HTTPure. You can run it with:
spago run -p registry-app -m Registry.App.Server
You can then send requests to
localhost:8080/app/v1/<operation>
to try out different operations. Be careful! This is going to actually do what you ask for: it will publish, unpublish, or transfer in the production environment.Here's what you should see on startup:
You can then send requests. For example, to publish a package:
You should see in the terminal:
and you should receive the error via curl. Same goes for say a bad JSON payload:
yields the result in the console:
Next Steps
This is meant as the first step in implementing a server just demonstrating that we can do it. But we should do more:
logs
directory, and with better names, too.12345
if the json is valid, and have a/status/12345
endpoint that has all its logs, and a/poll/12345
that just returns 'pending' or the terminal result). Compiling a package, for example, can take a while and cause the request to drop.That said, it does work, and we can build from here.