DEV Community 👩‍💻👨‍💻

Cover image for Let's create an API using deno!
rosnerdev
rosnerdev

Posted on

Let's create an API using deno!

Building APIs is one of my favourite things to build when it comes to programming.

Let's create one using deno!

For this tutorial we are going to be using fast, a minimalistic library which allows us to easily create fast APIs.

Let's see how it works:

  • Import the library
import fast from "https://deno.land/x/fast/mod.ts";
Enter fullscreen mode Exit fullscreen mode
  • Instantiate fast as a constant
const app = fast();
Enter fullscreen mode Exit fullscreen mode
  • Make a simple "Hello, World!" message appear in the / route
app.get("/", () => "Hello, World!");
Enter fullscreen mode Exit fullscreen mode
  • Serve the app
await app.serve()
Enter fullscreen mode Exit fullscreen mode

And that's it!
As simple as that, you created your own custom API using deno!

For more use cases and examples you can check out this link, in which you will find files containing examples.

Thanks for reading!

Top comments (0)

All DEV content is created by the community!

Hey, if you're landing here for the first time, you should know that this website is a global community of folks who blog about their experiences to help folks like you out.

Sign up now if you're curious. It's free!