项目作者: cubic-js

项目描述 :
📦 Easy to scale, zero-config, real-time focused app platform for node.js
高级语言: JavaScript
项目地址: git://github.com/cubic-js/cubic.git
创建时间: 2017-04-25T02:51:45Z
项目社区:https://github.com/cubic-js/cubic

开源协议:MIT License

下载


cubic

npm
Node version
dependencies
build


Cubic is a simple wrapper that integrates node.js frameworks into one platform that’s
easy to scale in docker or kubernetes.

This project is still very much in development and lacks documentation in some places, but
you can already check out how we’ve built NexusHub with
the help of Cubic.


Features

Cubic comes with everything needed to create a full-size web application for
modern standards:

  • Automatically routed API endpoints to HTTP and WebSockets
  • Webpack for optimal dev & prod bundling
  • Full OAuth2 integration
  • Pub/Sub model for real-time data
  • Rate limits and caching on a per-endpoint basis
  • Concise endpoint schema for automated unit tests

We provide all of these features regardless of which http/ws server you choose to use under the hood.


Usage

Before you get started, make sure you have redis and
mongodb running on their default ports.

To install cubic to your project:

  1. npm init
  2. npm install cubic cubic-api cubic-auth cubic-ui cubic-client cubic-defaults

This looks like a lot of things, but that’s because you don’t actually need more
than cubic and cubic-api for a minimal API server. Everything else only extends
the base functionality for the sake of showing you a fully working web-app.

Entrypoint

Next we’ll create index.js as our entrypoint to the server

  1. // index.js
  2. const Cubic = require('cubic')
  3. const cubic = new Cubic()
  4. // Load auth, view and api nodes needed for a basic setup
  5. cubic.bootstrap()

Ready to go

Now all we need to do is run

  1. node index.js

And Cubic will automatically create some default API endpoints and views
that you can learn the basics from.

You’ll now find your web-app on localhost:3000 🎉


License

MIT