Versioning projections code

Hi,

I am curious to know which are the ways to manage the projections code when using the EventStore.

For what I read in the documentation, the only way to create and modify them, is through the web console.

How do you manage it?

If you look the webui just uses a restful api

Is that RESTful API for projections documented yet? In my way of thinking, projections are code (much like stored procedures in a SQL Server database), and they should be versioned outside Event Store as code modules, then applied to a target Event Store instance during an automated deploy.

I’d like to use that REST API as the vehicle to apply some MyProjection.js file (with appropriate projection metadata encoded somehow) against an Event Store instance.

There is no documentation for the projections restful API yet. As Greg mentioned you can look in the web UI to see how it is being used. ProjectionsService.js and urls.js are good places to start.

If you are only interested in creating projections, you can post your projection to

/projections/?emit=<yes|no>&checkpoint=<yes|no>&enabled=<yes|no>&name=

For example, using curl:

curl -i -X POST -d @projection.js http://localhost:2113/projections/continuous?emit=yes&checkpoints=yes&enabled=yes&name=test_1 -H “Content-Type:application/json” -u “admin:changeit”

As well, the .net client offers support for projections through the ProjectionsManager class. We use this for precisely what you mention.

https://github.com/EventStore/EventStore/blob/699c17fc01ab633ceb14fac7a6e8ecd2c5535c18/src/EventStore.ClientAPI/Projections/ProjectionsManager.cs

Or you can use the EventStore.PAdmin.exe tool (though I personally have not) that is part of each release.