Package Exports
- node-snowflake
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-snowflake) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-snowflake
node-snowflake is a node.js clone for twitter snowflake.
###how to use
//only run simple http server
require('node-snowflake').Server(3001);
//request url example:GET http://localhost:3001/next_id?worker_id={optional}&data_center_id={optional}&sequence={optional}
//response : {"id":"439658373735124992"}
>//only run snowflake nextId
>var snowflake = require('node-snowflake').Snowflake;
>var id = snowflake.nextId(); // use default set
>//or
>//snowflake.init({worker_id : 1, data_center_id : 1, sequence : 0});
>//var id = snowflake.nextId();
>console.log(id);
###see examples/example.js