feathers-python
v0.8.0
Published
Node.js for creating Feathers.js Backend Services based on Python Scripts
Downloads
29
Maintainers
Readme
fython - feathers-python
Node.js module for creating Feathers.js Backend Services based on Python Scripts
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
- Go into project folder
- 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