feathers-python

0.8.0 • Public • Published

fython - feathers-python

Node.js module for creating Feathers.js Backend Services based on Python Scripts

Travis Status Downloads FOSSA Status

Requirements

Setup

$ npm install --save feathers-python

Usage

Given this python-script in 'test/helloWorld.py':

import sys as sys
print("Hello " + sys.argv[1] + "!")

Use this in your Feathers.js App:

const FythonService = require('feathers-python')
 
// given a feathers-app
app = feathers();
 
// register a python service to your app
const options = {
  scriptPath: 'test/helloWorld.py', // python script to be executed
  pythonVersion: 'v2' // python version 'v2' || 'v3'
};
 
app.use('/pythonScript', new FythonService(options));
 
// use the python service
service = app.service('pythonScript');
 
// POST /pythonScript
service.create({
  param1: 'Test'
}).then((result) => {
  console.log(result); // logs "Hello Test!"
});
 
// GET /pythonScript
service.find({}).then((result) => {
  console.log(result); // logs full content of the python script
});
 
// PATCH /pythonScript
service.patch(null, { content: 'content'}).then((result) => {
  console.log(result); // logs "content", updates python script content on disk
});

Testing

Run tests

  1. Go into project folder
  2. run npm test

Updating Changelog

We use github-changelog-generator for updating the Changelog automatically.

$ gem install github_changelog_generator
$ github_changelog_generator -u pinussilvestrus -p feathers-python --no-http-cache

Releasing

We use np for releasing new versions

$ npm i -g np
$ np

License

FOSSA Status

Package Sidebar

Install

npm i feathers-python

Weekly Downloads

7

Version

0.8.0

License

GPL-3.0

Unpacked Size

48.5 kB

Total Files

12

Last publish

Collaborators

  • pinussilvestrus