GithubHelp home page GithubHelp logo

csquirrel / noze.io Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nozeio/noze.io

0.0 1.0 0.0 726 KB

Evented I/O streams for Swift

Home Page: http://noze.io

Makefile 0.88% Swift 98.57% Shell 0.21% DTrace 0.34%

noze.io's Introduction

Noze.io

Swift2n3 Mac OS X iOS Linux Travis

"Das Haus das Verrückte macht."

Noze.io is an attempt to carry over the Node.js ideas into pure Swift. It uses libdispatch for event-driven, non-blocking I/O. Noze.io is built around type-safe back-pressure aware pull-streams (using Swift generics) operating on batches of items. Instead of just operating on bytes, operate on batches of Unicode lines or database records or HTML responses or - you get the idea. Be efficient: Stream everything and ßatch.

A focus is to keep the API similar to Node. Not always possible - Swift is not JavaScript - but pretty close. It comes with rechargeables included, Noze.io is self-contained and doesn't require any extra dependencies.

Noze.io works in Cocoa environments as well as on Linux, and it works with Swift 2.2 as well as the latest Swift 3 drop. In fact we suggest 2.2 until Swift 3 is actually released. Head over to our Start page for install instructions.

Is it a good idea? You tell us. Not sure, but we think it might be, because: a) While Swift looks very much like JavaScript, it is actually a very high performance statically typed and AOT-compiled language, b) Code often looks better in Swift, mostly due to trailing-closure syntax, c) No monkey patching while still providing extensions. There are cons too.

Shows us some code!

There is a reasonably large collection of simple, focused: Noze.io examples But here you go, the "standard" Node example, a HelloWorld httpd:

import http

http.createServer { req, res in 
    res.writeHead(200, [ "Content-Type": "text/html" ])
    res.end("\<h1\>Hello World\</h1\>")
  }
  .listen(1337)

An echo daemon, just piping the in-end of a socket into its own-out end:

import net

net.createServer { sock in
    sock.write("Welcome to Noze.io!\r\n")
    sock | sock
  }
  .listen(1337)

More complex stuff including a Todo-MVC backend can be found in the Noze.io examples. Like what you see? Head over to our Start page to get started.

Contact

Hey, we love feedback. Join the mailing list, Slack channel or just drop us an email to tell us why this is crap (or not?).

Status

  • We chose the traditional Swift approach: Make something barely usable, though demoable, and release it with a 2.0 version tag. Then hope that the community kicks in and fills open spots. Well kinda. It's pretty good already! 😉

  • It already has leftpad.

  • Implements primarily the happy path. Errors will error. Presumably this will improve over time.

  • A huge strength of Node is the npm package environment and the myriads of packages available for it. Or wait, is it? Well, at least we have leftpad included. And we hope that the Swift package environment is going to grow as well.

  • There are tons of open ends in Noze.io. We welcome contributions of all kinds.

Who

Noze.io is brought to you by The Always Right Institute and ZeeZide. We wouldn't be sad if more people would like to join the effort :-)

noze.io's People

Contributors

helje5 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.