Giter VIP home page Giter VIP logo

atom's Introduction

Carbon.io

Travis build status npm Version npm downloads supported node versions MIT License

Carbon.io is an application framework based on Node.js and MongoDB for building command line programs, microservices, and APIs.

With Carbon.io you can create simple, database-centric microservices with virtually no code. At the same time Carbon.io is designed to let you under the hood and allows you to write highly customized APIs much like you would with lower-level libraries such as Express.js.

Quickstart

To install:

$ npm install carbon-io

Copy the following code into service.js:

var carbon = require('carbon-io')

var o  = carbon.atom.o(module).main
var __ = carbon.fibers.__(module)

__(function() {
  module.exports = o({
    _type: carbon.carbond.Service,
    port: 8888,
    endpoints: {
      hello: o({
        _type: carbon.carbond.Endpoint,
        get: function(req) {
          return { msg: "Hello world!" }
        }
      })
    }
  })
})

This will create a Carbon.io service which will respond with "Hello world!" on the /hello endpoint. Run the service with:

$ node service

And test it using:

$ curl localhost:8888/hello

Documentation

Interested in getting started with Carbon.io? Check out our detailed documentation on the Carbon.io website.

Contributing

Interested in contributing to Carbon.io? We love to receive new contributions! There are many ways to contribute, from writing tutorials or blog posts, improving the documentation, submitting bug reports and feature requests or writing code which can be incorporated into Carbon.io itself.

Check out our CONTRIBUTING.md for tips on how to get started!

License

MIT License

atom's People

Contributors

agjohnson avatar chrisckchang avatar gregbanks avatar jcottr avatar tfogo avatar willshulman avatar

Watchers

 avatar  avatar  avatar

atom's Issues

docs - title level inconsistent

We are getting these warnings on build:

carbon-io/docs/packages/carbon-core/docs/packages/atom/docs/index.rst:341: SEVERE: Title level inconsistent:

Argument Parsing
^^^^^^^^^^^^^^^^
/carbon-io/docs/packages/carbon-core/docs/packages/atom/docs/index.rst:374: SEVERE: Title level inconsistent:

Main
^^^^

What title level should these be?

Argument Parsing: https://github.com/carbon-io/atom/blob/master/docs/index.rst#L341
Main: https://github.com/carbon-io/atom/blob/master/docs/index.rst#L374

arg parser: Command name cannot match "full"

For example

cmdargs: {
  me: {
    command: true,
    full: "me"
 },
...

This will barf on this line

delete commands[fullCommand].full

In this case you would just not specify full and it would work but it took me a while to figure that out since i was copying commands from a template.

TypeError: Cannot convert undefined or null to object
    at Atom._initArgParser (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:620:24)
    at Atom._processCmdargs (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:502:10)
    at Atom._invokeMain (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:412:27)
    at Atom._runMain (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:403:12)
    at Atom._makeObject (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:162:16)
    at Atom.make (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:117:24)
    at /Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:791:19
    at /Users/abdul/github/mlab/mlab-cli/bin/mlab:8:3
    at fiberFunction (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/fibers/index.js:219:13)
Exception caught with error undefined in fibers.spawn: TypeError: Cannot convert undefined or null to object
    at Atom._initArgParser (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:620:24)
    at Atom._processCmdargs (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:502:10)
    at Atom._invokeMain (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:412:27)
    at Atom._runMain (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:403:12)
    at Atom._makeObject (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:162:16)
    at Atom.make (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:117:24)
    at /Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/atom/lib/atom.js:791:19
    at /Users/abdul/github/mlab/mlab-cli/bin/mlab:8:3
    at fiberFunction (/Users/abdul/github/mlab/mlab-cli/node_modules/@carbon-io/fibers/index.js:219:13)

This is because delete commands[fullCommand] attempts to delete an entry that doesn't exist anymore since it was deleted by delete commands[command]

Can we remove options vs deprecate?

I think it is safe to just remove option / options

WARNING: "options" and "option" are deprecated, use "cmdargs" instead.
WARNING: "options" and "option" are deprecated, use "cmdargs" instead.

add "script" to cmdargs processing

allow a class to define the script's name via nomnom's "script" method for help output (necessary for static docs generator output...)

show a sane error message when a user mixes subcommands and options

it is currently very misleading

> var p = nomnom()
> p.option('foo', {'abbr': 'f', 'help': 'foo'})
> c = p.command('bar')
> c.option('baz', {'abbr': 'b', 'help': 'baz', 'flag': true})
> var args = ['-f', 'foo', 'bar', '-b']
> p.parse(args)
'-b' expects a value


Usage: /Users/Greg/.pyenv/versions/2.7.10/envs/carbonio-dev-env/bin/node undefined <command> [options]

command     one of: bar

Options:
   -f, --foo   foo

here, -b is a flag and should not expect a value

document constructor chaining semantics

it's not obvious from the REAME that arguments to a class' constructor are not passed on to a superclass' constructor when atom automatically chains constructor calls. i would assume that arguments would be passed with automatic chaining, otherwise all superclass constructors (and all constructors for classes that may be subclassed in the future) have to behave like default constructors. if this is a requirement, then maybe this should be documented. on the flip side, if arguments are passed, then you end up with longer and longer parameter lists as you work your way through the class hierarchy with each subclass being beholden to the signature of its superclass constructor... also not ideal.

in any case, it seems like the final decision as to how this should work has not been made: https://github.com/carbon-io/atom/blob/master/lib/atom.js#L242

add aliasing to environment variables

add another property to the environment variable config to allow for aliasing similar to cmdargs (i.e., "full") so that you can reference environment variables from within your application using "short" names while ensuring that there are not conflicts at the environment level by doing the appropriate mangling (e.g., we might have an environment variable named "MY_APP_PREFIX_FOO" that we want to reference in our app by "FOO".

Docs pulling wrong code frag

docs/guide/index.rst is pulling the wrong fragments from docs/code-frags/standalone-examples/instantiation/simpleInvoke.js.

In docs/guide/index.rst the second block is set to pre-simpleInvoke but the output is the pre-simpleInvokeNoType block.

The fourth block is set to pre-simpleInvokeWithProperties but the output is the pre-simpleInvokeWithPropertiesNoType fragment.

environmentVariables

  • Declare env variables in cmdOptions or top-level like cmdOptions
  • Have Atom remove them from process.env and store somewhere else
    (configurable whether they should be removed)
  • Have env: go to that other place

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.