Skip to content

Releases: encoredev/encore

v0.16.2: RESTful API support

09 Jul 11:01
Compare
Choose a tag to compare

Encore now has support for defining RESTful APIs in an easy, powerful way!

API Paths

Defining APIs can now include the path=/foo/bar and method=FOO parameters to customize the HTTP path and method the API is exposed at:

type CreateOrderParams struct { /* ... */ }
type Order struct { /* ... */ }    

//encore:api public path=/orders method=POST
func CreateOrder(ctx context.Context, p *CreateOrderParams) (*Order, error) { /* ... */ }

Path parameters

You can also define custom API path parameters such as path=/orders/:id.

When you specify a parameter, Encore passes that parameter directly to your function as a separate argument, like so:

type Order struct { /* ... */ }    

//encore:api public path=/orders/:id method=GET
func GetOrder(ctx context.Context, id int) (*Order, error) { /* ... */ }

Encore automatically performs validation of the parameter, according to the type used in the function signature.
In this case id must be an integer. You can also use string, bool, uint8, and so on. You can even use encore.dev/types/uuid.UUID if you want to receive UUIDs.

Conflicting paths

Encore parses all the APIs in your application and ensures they don't conflict. For any given API call there can only ever be zero or one API that matches. If you define paths that conflict, Encore raises a compilation error.

Making API calls between services

Like always, Encore makes it easy to do API calls between services, and these parameterized APIs work just as easily as before: just call the function: service.GetOrder(ctx, 5).

Secrets Management

Encore's web platform now provides much-improved secrets management support. You can view, update, and roll back secrets to previous versions.

Contributions

  • Many thanks to @Willyham for initiating the custom API path support and implementing a large part of it!

v0.15.0: Custom API paths

09 Jul 10:07
958a2b7
Compare
Choose a tag to compare

Encore now supports customizing the HTTP path of API raw endpoints. The next release will include complete support for all types of API endpoints.

//encore:api public raw path=/hello/:name
func Greet(w http.ResponseWriter, req *http.Request) {
    name := strings.TrimPrefix(req.URL.Path, "/hello/")
    fmt.Fprintf(w, "Hello, %s!", name)
}

v0.14.0: Improved tracing

09 Jul 10:03
Compare
Choose a tag to compare

Encore now includes even better Distributed Tracing support out of the box!

Stack traces

Stack traces are incredibly useful for debugging, but common wisdom is that they're too slow to collect at scale.
Encore's deep integration across the stack enabled us to do this in a highly performant way, by only snapshotting
program counters at runtime and mapping it to source code information when the trace is viewed.
This enables Encore to collect stack traces in less than 300ns!

The end result is that Encore now provides complete stack traces for all events, including API calls, database queries, log messages, and so on.

Automatic HTTP Tracing

Encore now also includes automatic tracing of outgoing HTTP requests. This also works out of the box, and works for all HTTP calls using Go's standard library net/http package.

Hope you enjoy the new release!

v0.13.1: Error handling bonanza!

04 May 13:28
Compare
Choose a tag to compare

Encore now has great built-in support for API errors. Features include:

  • Return errors with specific HTTP status codes
  • Return structured errors, along with structured additional details
  • Support for key-value metadata that is propagated between services

All of this is made possible using the encore.dev/beta/errs package.
Read all about it in the Encore docs!

v0.12.0

17 Apr 14:06
417831b
Compare
Choose a tag to compare

Encore now adds structured log messages to the automatic tracing, using encore.dev/rlog.
Log messages written during traced requests are automatically added to the trace.

The structure of additional fields is preserved, allowing us to index and filter by structured log context later!

v0.11.1

17 Apr 13:59
417831b
Compare
Choose a tag to compare

This release fixes a few minor issues discovered following the open-source release:

  • Fix encore db shell for local development
  • Add log message when a request to an auth endpoint lacks an Authorization header
  • Improved help for encore gen client
  • Other miscellaneous fixes