Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/unistra/ls-spore
A client-side livescript/javascript spore client
https://github.com/unistra/ls-spore
Last synced: 10 days ago
JSON representation
A client-side livescript/javascript spore client
- Host: GitHub
- URL: https://github.com/unistra/ls-spore
- Owner: unistra
- Created: 2015-01-23T08:24:31.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-06T12:45:19.000Z (almost 8 years ago)
- Last Synced: 2024-10-21T15:03:35.031Z (27 days ago)
- Language: LiveScript
- Size: 6.46 MB
- Stars: 3
- Watchers: 21
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
ls-spore
=========.. image:: https://travis-ci.org/unistra/ls-spore.svg?branch=master
:target: https://travis-ci.org/unistra/ls-sporeA client-side livescript/javascript spore client
Usage
=====Install with bower
------------------.. code-block:: bash
bower install ls-spore
Example
-------Include and use "build/spore-client.min.js" :
.. code-block:: html
ls-spore example
s = new Spore("http://serverurl/spore-description.json", function(){
if (s.isReady) {
s.enable(SporeMiddlewareAuthApiKey, {key_name:"Authorization", key_value:"Token S3CR3T"});
s.logBasicInfos()s.methods.get_user({
format: "json",
username: "toto"
}, function(response){
console.log("Recuperation de toto ... :");
return console.log(response);
},
function(){
console.log("Error with the spore method");
});
}
},
function(){
console.log("Error with the spore client creation");
},
base_url = "http://127.0.0.1:8000");
Imports with es2015
-------------------.. code-block:: javascript
import { SporeMiddlewareAuthApiKey, Spore } from "spore-client.min.js"
Developement
============Use Livescript
--------------
use the following lines to compile livescript to javascript :.. code-block:: bash
sudo npm install -g LiveScript
lsc -wc -o src/js/ src/ls/*.ls
lsc -wc -o test/js/ test/ls/*.lsuse the following line to create a minified JS
.. code-block:: bash
sudo npm install -g uglify-js
uglifyjs src/js/request.js src/js/middleware.js src/js/spore.js -o build/spore-client.min.jsUnit test with karma
--------------------
Install nodejs and mongodb :.. code-block:: bash
sudo apt-get install nodejs npm
sudo apt-get install mongodbRun a test WS and install and run karma :
.. code-block:: bash
cd test
sudo npm install
npm start
npm testImplemented
-----------* base_url
* description
* version
* authority
* meta
* name
* methods
* methods -> name
* methods -> path
* methods -> required_params
* methods -> optional_params
* methods -> headers
* methods -> base_url
* methods -> payload
* methods -> required_payload
* methods -> expected_status
* create spore client
* url for description file
* enable middleware
* middleware auth by token
* authentication (only for Authorization header)
* enable if middlewareNot Implemented
---------------* authentication (currently, only for Authorization header)
* unattended_params
* formats (currently, only JSON)
* methods -> form-data
* methods -> optional_payload
* methods -> unattended_params
* methods -> description
* methods -> deprecated
* methods -> authentication (currently, only for Authorization header)
* methods -> formats (currently, only JSON)
* disable middlewareTODO
----* put client's meta data in a _meta variable and remove methods variable
* be more livescript idiomaticSpore UI
========
* See the `ls-spore-ui`_ repository.. _ls-spore-ui: https://github.com/unistra/ls-spore-ui