Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
January 19, 2022 01:18 am GMT

Automagically REST and GraphQL endpoints from your Azure SQL database

I'm pretty sure that at some point of your developer career you have wished - dreamed! - to have something that could turn your database tables exposed as a REST or GraphQL endpoint, automatically, just by expressing that intention (maybe via a configuration file or some other conventions).

Such a thing could make your life so much easier and your work more efficient for certain projects.

Well...dream no more, now there is a solution for that and it is free and open source!

And yes, for solution I really mean creating a GraphQL and REST endpoint starting from a database (maybe even from an existing table) without the need to write any code at all.

Curious? Well, I'm sure. So, if you want to go head down to the code and the details, you can just head to this GitHub repo:

GitHub logo Azure-Samples / azure-sql-db-rest-graphql-directus

A full end-to-end demo using Vue, Directus, REST, GraphQL and Azure SQL database to create a modern Todo list solution

where you can create a full-stack / Jamstack end-to-end solution, to store a To-Do list in an Azure SQL database, and present it via Vue.JS, communicating entirely via REST or JSON.

The sample implementation uses:

  • Azure Web App: to run the Directus container
  • Vue.Js as front-end client
  • Directus to provide GraphQL and REST endpoints automatically from the Azure SQL database
  • Azure SQL as database to store ToDo data

Directus is a Node application you can run in Azure using, for example, a container. Once it is running, you just have to configure which tables you want to expose via REST and GraphQL, configure the permission level (I'm quite sure you don't want to make all your table publicly available) and...nothing else, you're done. Of course, you can do much more, but if you don't need any additional complexity, this is really all you have to do.

You can go from a completely no-code/low-code approach to a more developer oriented one (as I did, for example, in the deployment script, where I also create sample To-Do items via the REST endpoint), so depending on where you are in our career or position, you can decide what is best for you. As a developer I'm just glad that I don't have to write any plubming code anymore (unless I really need to, in that case I may want to use Prisma or Dapper).

Aside from the aforementioned GitHub post, you can also learn more about Azure SQL and Directus via this nice blog post that we just published:

https://devblogs.microsoft.com/azure-sql/automatic-graphql-and-rest-endpoint-for-azure-sql-with-directus/

Enjoy! (I surely enjoyed it A LOT!)


Original Link: https://dev.to/azure/automagically-rest-and-graphql-endpoints-from-your-azure-sql-database-40j9

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To