June 4, 2020

Angular and React code generation

I'm excited to announce that it's now possible to generate client code to connect to your Stackprint API from Angular & React!

That means you won't have to write interfaces matching your Stackprint resources or build HTTP requests yourself anymore. 😎

The generated code already contains interfaces for all resources that your API manages and type-safe methods for all request that your Stackprint API supports. This is what listing notes using generated client code looks like in Angular:

{% c-block language="typescript" %}
import { NoteService, Note } from 'gen/typescript-angular-client'

export class AppComponent {
 notes: Observable<Note[]>

 constructor(private noteService: NoteService) {}

 ngOnInit() {
   this.notes = this.noteService.listNotes()
 }
}
{% c-block-end %}

Client code generation for your project is available directly from your Stackprint Dashboard:

Check out these code examples on GitHub to see how generated client code works in a full app with authentication:

Angular: https://github.com/stackprint/example-notes-angular

React: https://github.com/stackprint/example-notes-react

Client code generation for more languages and frameworks will follow soon.

Happy coding! 👨‍💻

Latest Posts