Socket
Socket
Sign inDemoInstall

entix-core

Package Overview
Dependencies
13
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    entix-core

Entix-core speeds up the development of Koa APIs by combining the benefits of several technologies to provide basic CRUD capability straight out of the box.


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

entix-core

Entix-core speeds up the development of Koa APIs by combining the benefits of several technologies to provide basic CRUD capability straight out of the box.

Motivation

When developing server-side applications from scratch, writing basic CRUD operations takes a significant amount of time. To that end, the Entix Ecosystem was created to provide developers with tooling that eliminates the need for them to write generic code, allowing them to focus on more difficult aspects of their project. Entix-Core, as the name implies, is at the core unit of all Entix-Projects responsible for loading and running Entix projects.

Getting Started

  • $ npm i joi kcors knex koa koa2-formidable lodash objection pluralize sqlite3

index.js

const app = new (require('koa'))
const cors = require('kcors')
const bodyparse = require('koa2-formidable')
const config = require('./config')
const projectPath = require('path').resolve(__dirname, 'src')
global.entix = require('entix-core')(projectPath)

app.use(bodyparse(config.bodyParser))
app.use(cors())
app.use(entix.errodHandler(entix.services.handler))
app.use(entix.router.routes())

app.listen(config.server.port, () => {
    console.log('running at:', config.serverUrl)
})

config.js

const { Config } = require('entix-core')

const config = {
    
    server: {
        protocol: 'http',
        hostname: 'localhost',
        port: 3000,
    },

    crypto: {
        secret: '{{cryptoSecret}}',
        algorithm: '{{cryptoAlgorithm}}'
    },

    ws: {
        cors: { origin: '*' }
    },

    bodyParser: {
        multipart: true,
        maxFileSize: 5000 * 1024 * 1024
    },

    jwt: {
        access: {
            secret: '{{accessTokenSecret}}',
            options: {
                expiresIn: '{{accessTokenExpiry}}'
            }
        },

        refresh: {
            secret: '{{refreshTokenSecret}}',
            options: {
                expiresIn: '{{refreshTokenExpiry}}'
            }
        },
    },
}

module.exports = new Config(config)

knexfile.js

module.exports = {

  /* SQLITE */
  development: {
    client: 'sqlite3',
    useNullAsDefault: true,
    connection: {
      filename: './store/store.sqlite3'
    },
    seeds: {
      directory: './store/seeds'
    },
    migrations: {
      tableName: 'knex_migrations',
      directory: './store/migrations'
    },
    pool: {
      min: 2,
      max: 10
    },
  },

  /* POSTGRES */
  // development: {
  //   client: '{{dbClient}}',
  //   connection: {
  //     host: '{{dbHost}}',
  //     port: '{{dbPort}}',
  //     user: '{{dbUser}}',
  //     password: '{{dbPassword}}',
  //     database: '{{dbName}}',
  //   },
  //   seeds: {
  //     directory: './src/db/seeds'
  //   },
  //   migrations: {
  //     tableName: 'knex_migrations',
  //     directory: './src/db/migrations'
  //   },
  //   pool: {
  //     min: 2,
  //     max: 10
  //   },
  // },
};

Entix Ecosystem

Currently, the Entix Ecosystem consists of two projects:

  • Entix Core: loads and runs Entix projects.
  • Entix CLI: generates template Entix projects.

Structure of an Entix Project

├── README.md
├── config.js
├── index.js
├── knexfile.js
├── package-lock.json
├── package.json
├── src
|  ├── api
|  ├── middleware
|  └── services
└── store
   ├── migrations
   ├── seeds
   └── store.sqlite3

directory: 7 file: 7

FAQs

Last updated on 19 May 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc