VOOZH about

URL: https://thenewstack.io/how-to-get-started-building-serverless-backends-with-dark/

⇱ How to Get Started Building Serverless Backends with Dark - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2022-05-18 06:00:54
How to Get Started Building Serverless Backends with Dark
tutorial,
Frontend Development / Software Development

How to Get Started Building Serverless Backends with Dark

Although mysterious, Dark was clearly set up to talk REST and, in their words, Dark is a new way of building serverless backends.
May 18th, 2022 6:00am by David Eastman
👁 Featued image for: How to Get Started Building Serverless Backends with Dark
Feature image via Shutterstock.

One of the earlier promises of serverless was a speedier time to resolution because you could start working without the need to set up infrastructure. I heard about Dark a year ago in a changelog podcast, and immediately looked at it. When it was unveiled in 2019, Dark was described as “a holistic programming language, editor, and infrastructure for building backends.” Although it sounds a bit mysterious, it was clearly set up to talk REST and, in their words, “Dark is a new way of building serverless backends.”

Dark is a little like one of those salsa lessons, where you feel the teachers are so good they can no longer remember what having no rhythm feels like. But working with HTTP and JSON is not unlike a formal dance. You send a request, and you receive a response. The body of the response is in JSON. There are conventions you should know, and some you can pick up. I assume for this article you are at least familiar with the music.

What the Dark interface does is automate some of the tedious communication. Above all this, you don’t have to write any code. We were to some degree sold a future in which coding would no longer be necessary, and that development would be democratized by voice recognition and well-developed user interfaces. That future is still a little further away, but it is wise to spot the patterns that are coming.

OK, now let’s dive straight into the Dark. You can immediately create a canvas by simply claiming a URL based on your username right in your browser, and then work on that page. Below I created “eastmad-thenewstack” and wrote a GET response for a “/greeting” endpoint.

👁 Image

Immediately, this will respond from the “builtwithdark” domain:

👁 Image

That was nice and fast. But I could have done this the other way around, and hit my endpoint with a novel request first, with no backend implementation:

👁 Image
Back on my canvas, Dark has stored the trace as a 404, so I can quickly work with it:

👁 Image

By hitting that plus, I will be able to respond to the GET request from “/leaving” in the same way I responded to “/greeting” above. This is what they refer to as Trace Driven Development. Working almost by reverse engineering traces does make you feel like a bit of a detective — almost, dare I say it, like a hacker. Except we are spying on a dance.

Revisiting the Dark site, they now have support for OAuth2, the three-way authorization trust tango between a Resource Owner, a client application and a Resource Server expressed in the language of tokens. Dark also has an example of creating a backend for a Slack App, which will be visible as a Slackbot. While the example is tricky, it does give us a chance to play with a set of useful techniques, including OAuth.

Even if you have admin authority for a Slack workspace, platform security is still carefully managed. A quick perusal of api.slack.com/app will show you a nice “Create an App” option, and looking at Basic Information you can see there is quite a lot of stuff:

👁 Image

(Note that full stop sitting in the middle of the numbers in that Client ID; this indicates it must be dealt with as a string.)

Now, we have to get a bit more into the intricacies of the dance. We need to create a Redirect URL within Slack that will start our trace procedure (look in ‘OAuth & permissions’).

👁 Image

Dark wants a user to use “/oauth-redirect” as the route to the canvas. Within Slack, go to Manage Distribution and copy the Shareable URL. Finally, we have something to call our backend with. By calling this we will hit our Dark canvas and start the trace.

👁 Image

Indeed, it is waiting in our canvas 404 list. We can now create the response to the GET:

👁 Image

So far, so good. We have triggered the redirect and we can see the full request that Dark got. So what do we send back? Well, we have our “Client Id” and “Client Secret” above from Slack. So we can create a POST within Dark and continue the dance.

We need to create a POST body, and this is where you need to think in JSON format — even though Dark kind of elides this. As we select the post response, Dark informs us of the parameters like any good IDE. A string for the URL to the Slack API, the body of the post, then two sets of key/value pairs that are themselves dictionaries.

👁 Image

The actual format of the body is mentioned in the example. The client_id and client_secret would be your strings of course:

👁 Image

So we are communicating directly with Slack’s OAuth API.  Note that the value for the “code” key is taken from the request that Dark received (off the bottom of my image above), and it parses the JSON, so you can enter “request.queryParams.code”. When we send the POST, what we hope to get back are the correct access tokens.

I will stop the trace work here for this article, but if you want to continue with the example, follow the link above for the backend walkthrough to create a simple Slackbot. I admit I could not repeatedly get this to work — but with feedback, even failure is fairly instructive.

Conclusion

What have we picked up from all this?

  • A smart user interface can work well for with familiar patterns, which users of IDEs and statically typed languages have been exploiting for years.
  • REST continues to be a great way to form and understand APIs. The more complex payloads should just encourage more tools like Dark, that help explore service offerings.
  • Working within various separate trust bodies or their simulations is a great way to understand a system, but it is still complicated. It is like holding several bunches of jangling keys and security cards, which must nevertheless be used in a specific order.
  • Don’t stop the dance.
TRENDING STORIES
David has been a London-based professional software developer with Oracle Corp. and British Telecom, and a consultant helping teams work in a more agile fashion. He wrote a book on UI design and has been writing technical articles ever since....
Read more from David Eastman
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.