0.1.6-alpha • Published 6 years ago

@cloud-node/server v0.1.6-alpha

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

cloud-node-server

Cloud-node - web framework build on top of ExpressJS

Logo

npm npm

Very powerful framework, that allow you very quick, and simple start develop any API, with just config, without any programming.

Versions

Node v8.9.4 (npm v5.7.1)

Install

  npm install @cloud-node/server@0.1.6-alpha

How to use

  const { server } = require('@cloud-node/server');
  server.start({
    pm2: process.env.NODE_ENV === 'development' ? true : false
  });

If option pm2 is enabled in console you will see pm2 monitor image

Setup

Routes

Create configuration file for routes config/routes.yml with next structure

routes:
  - namespace:
      name: 'apis'
      resources: # - Resource will provice all RESTful API methods for controller home
        - home:
      cloud: # - Endpoint will look like: (GET) /apis/cloud/index
        - get:
            action: 'index'
        - get:
            as: 'home' # - Endpoint will look like: (GET) /apis/cloud/home
            controller: 'cloud'
            action: 'home'
        - all: # - Endpoint will allow all request methods
            controller: 'cloud'
            action: 'all'

Polices

Protect you route with polices, create file config/polices.js

  module.exports = {
    isAuth: (req, res, next) => ( req.user.isAuth ? next() : next('User not authorized.') )// Checking if user authorized
  }
  - get:
      action: 'index'
      polices:
          - 'isAuth'
          # ...

Controllers

Create controller file in the application root folder controllers/cloud.js

  module.exports = {
    index: (req, res) => res.ok('Hi, cloud-node.')
  }

routes configuration

  - get: # - Endpoint will look like: (GET) /apis/cloud/index/:id
      as: 'index/:id'
      controller: 'cloud'
      action: 'index'

Models

@TODO: - In progress

Plugins

@TODO - In progress

0.1.6-alpha

6 years ago

0.1.6

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.5-alpha

6 years ago

0.0.4-alpha

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.2-alpha

6 years ago

0.0.1-alpha

6 years ago