Context

I have always been interesting in writing in particular. But as I grow up psychologically, I started to see the activity underlying writing and other linguistic practical usage: constructing…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Building a Dart server from scratch

Part 1 in a series about Server Side Dart without a framework

Since the A’s are out, it’s time for plan B.

While frameworks are nice, there’s always a bit of magic about them. The dart:io library, which is one of the core Dart libraries, already includes the low-level classes and functions needed to make an HTTP server. So this article will teach you how to create such a server yourself.

Let’s get started. The full code is at the end of the article if you get lost along the way.

This creates a server that listens to the localhost IP address (127.0.0.1) on port 4040.

You can start your server from the terminal like this:

You should see the following printout:

Congratulations! You’ve already made a Dart server. That was pretty easy, wasn’t it?

You’ve started the server, but it doesn’t really do anything yet. Force close your program by pressing…

Add a comment

Related posts:

When The Sun Goes Down

The only sound I can hear is the leaves rustling on the trees around me as I watch the sun setting behind the mountains, leaning on the wooden rail like I’m trying to get as close as humanly possible…

Mowing Through API Request Limiting with Redis

Imagine you wrote a web app that also provides a REST API to users. Also imagine this app is just a hobby project, so between your day job, family life, yard work, and cryptocurrency trading you only…

You Can Fuck Me Now

Ok! All my female fans who find me irresistible (hey, mom)! I am effectively billed out and bound to go (old blues reference). Y’all can fuck me now! I’m good to go. Let me be serious for a…