a-bowers / ymir

A WSGI compliant server for Node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ymir

Python WSGI middleware for your Express app.

Why?

While writing a good Python compiler for https://webtask.io / https://goextend.io in Node.JS it became evident that we were going to waste CPU cycles creating a proxy server or something similar. Looking at bjoern's internals showed it was practically using Node.JS's old HTTP parser and an event loop, so at this point, might as well just have it in Node. Good parts are you can seamlessly share Python and Node code, and since it's a single application it's neat!

Can I use it in production?

Maybe? vOv YMMV.

Show me the ways!

const express = require('express');
const ymir    = require('ymir');
const app     = express();
app.use(ymir.middleware(['path/to/python', 'app_name_exported']));
app.use(ymir.middleware(('python.node').import('foo.bar').some_app));

app.listen(4040);

Or the webtask-ified version:

const ymir = require('ymir');

// 
module.exports = ymir.load('path.to.file')['appName'];
module.exports = ymir.wsgi('path.to.file:appName');


// or 
module.exports = ymir.execute(`
def app(ctx, cb):
    cb({
        "How to auth": [
            "Get access token", 
            "Call API"
        ]
    })
`).app;

About

A WSGI compliant server for Node


Languages

Language:C++ 51.5%Language:TypeScript 36.4%Language:JavaScript 6.4%Language:Python 5.7%