![bjm](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2021-09-25%2F2525966742310_bf56faebe4648f979cc1_192.png&w=96&q=75)
![ricey emoji](/_next/image?url=https%3A%2F%2Femoji.slack-edge.com%2FT0266FRGM%2Fricey%2Fc59610dc9b45a947.png&w=96&q=75)
Posts tagged with :ricey:
![bjm](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2021-09-25%2F2525966742310_bf56faebe4648f979cc1_192.png&w=96&q=75)
![rajanagarwal](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2023-04-27%2F5194849055457_b30e7c5183da9b1d9acf_192.png&w=96&q=75)
![rishi](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2023-06-17%2F5436191364262_871f10efad02ccd8a027_192.png&w=96&q=75)
define middleware { test, logger } from "./api" define guards { authed } from "./api" define handlers { getAllTodos, postTodos } from "./api" global | middleware logger fragment getTodosFragment(level) | guard authed(level) | middleware test route "/todos" { | middleware test get { | expand getTodosFragment("user") getAll } post { | expand getTodosFragment("admin") postTodos } } 🛠️ The Idyllic language reverses the conventional paradigm that surrounds Node REST APIs: usually, you have to write your functions _for a framework_. With Idyllic, you can assemble your API completely independently of your functions themselves—now, an API is simply a wrapper over regular old Typescript functions! The language itself comes with a pretty big suite of features (you can read more about them at the Github page): • Static typing with Typescript & definition types • Parameterized, first-class macro support with Fragments • Data pipelines with Sequences • First-class support for Middleware and Guards • Query parameter capturing • Request type definitions 🕸️ The repository also comes with a minimal HTTP server that takes in a compiled Idyll and starts up a fully-functioning API from it: import { IdyllicCompiler } from "@idyllic/compiler"; import { IdyllicServer } from "@idyllic/server"; (async () => { // The fromFile static method reads the file into a string for us const compiler = await IdyllicCompiler.fromFile("ast.idl") // The compile method executes all 5 stages of compilation automatically. const compiled = await compiler.compile() // The server constructor takes in a compiled Idyllic object. const server = new IdyllicServer(compiled) // The start function takes in a port number (defaults to 3000) and a function to be executed on start. server.start(3000, () => { console.log("Idyllic server has started!") }) })()💨 This server implementation’s pretty fast, too: in most cases, it comes close to (and in some cases, beats) Express! It’s derived directly from node’s built-in
http
module.
Idyllic’s been a project that I’ve dreamt of making for quite a while now, and I’m super happy with how it turned out! I’ve included a little walkthrough of an Idyllic project down below :) I can’t wait to see what you’ll build with it!
Special thanks to @JackyZhao @matthewgleich @safin.singh for being awesome along the way ✨![ktm](/_next/image?url=https%3A%2F%2Fdl.airtable.com%2F.attachments%2Fef3efa99d1b6dd6e0db8edbb90dc5713%2F60dd08ae%2F1349961005680_43793c7dcbc976aae457_192.jpg&w=96&q=75)
![rishi](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2023-06-17%2F5436191364262_871f10efad02ccd8a027_192.png&w=96&q=75)
![rishi](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2023-06-17%2F5436191364262_871f10efad02ccd8a027_192.png&w=96&q=75)
![elizabethq](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2020-08-27%2F1340518660017_dc709f8024cee5693112_192.png&w=96&q=75)
![linus](/_next/image?url=https%3A%2F%2Favatars.slack-edge.com%2F2024-06-04%2F7218498373510_fc4881b7de744bf4a650_192.png&w=96&q=75)
:ricey2:
The lineup: 🍚 :ricey: 🎑 🍙 🍘 🌾 :ricey2: