How to use the nodal.require function in nodal

To help you get started, we’ve selected a few nodal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github keithwhor / nodal / src / app / app.js View on Github external
module.exports = (function() {

  'use strict';

  const Nodal = require('nodal');

  /* Import Initializers */
  const StaticAssetInitializer = Nodal.require('initializers/static_asset_initializer.js');

  /* Import Middleware */
  const CORSMiddleware = Nodal.require('middleware/cors_middleware.js');

  /* Import Renderware */
  const GzipRenderware = Nodal.require('renderware/gzip_renderware.js');

  /* Import Router */
  const router = Nodal.require('app/router.js');

  /* Import Database */
  // const db = Nodal.require('db/main.js');

  /* Import Scheduler */
  // const scheduler = Nodal.require('schedulers/main.js');


  class App extends Nodal.Application {

    __setup__() {

      /* Initializers */
github keithwhor / nodal / src / app / app.js View on Github external

  'use strict';

  const Nodal = require('nodal');

  /* Import Initializers */
  const StaticAssetInitializer = Nodal.require('initializers/static_asset_initializer.js');

  /* Import Middleware */
  const CORSMiddleware = Nodal.require('middleware/cors_middleware.js');

  /* Import Renderware */
  const GzipRenderware = Nodal.require('renderware/gzip_renderware.js');

  /* Import Router */
  const router = Nodal.require('app/router.js');

  /* Import Database */
  // const db = Nodal.require('db/main.js');

  /* Import Scheduler */
  // const scheduler = Nodal.require('schedulers/main.js');


  class App extends Nodal.Application {

    __setup__() {

      /* Initializers */
      this.initializers.use(StaticAssetInitializer);

      /* Middleware */
github keithwhor / nodal / src / app / router.js View on Github external
'use strict';

const Nodal = require('nodal');
const router = new Nodal.Router();

/* Middleware */
/* executed *before* Controller-specific middleware */

const CORSMiddleware = Nodal.require('middleware/cors_middleware.js');
// const CORSAuthorizationMiddleware = Nodal.require('middleware/cors_authorization_middleware.js');
// const ForceWWWMiddleware = Nodal.require('middleware/force_www_middleware.js');
// const ForceHTTPSMiddleware = Nodal.require('middleware/force_https_middleware.js');

router.middleware.use(CORSMiddleware);
// router.middleware.use(CORSAuthorizationMiddleware);
// router.middleware.use(ForceWWWMiddleware);
// router.middleware.use(ForceHTTPSMiddleware);

/* Renderware */
/* executed *after* Controller-specific renderware */

const GzipRenderware = Nodal.require('renderware/gzip_renderware.js')

router.renderware.use(GzipRenderware);
github keithwhor / nodal / src / app / app.js View on Github external
module.exports = (function() {

  'use strict';

  const Nodal = require('nodal');

  /* Import Initializers */
  const StaticAssetInitializer = Nodal.require('initializers/static_asset_initializer.js');

  /* Import Middleware */
  const CORSMiddleware = Nodal.require('middleware/cors_middleware.js');

  /* Import Renderware */
  const GzipRenderware = Nodal.require('renderware/gzip_renderware.js');

  /* Import Router */
  const router = Nodal.require('app/router.js');

  /* Import Database */
  // const db = Nodal.require('db/main.js');

  /* Import Scheduler */
  // const scheduler = Nodal.require('schedulers/main.js');


  class App extends Nodal.Application {
github keithwhor / nodal / src / app / router.js View on Github external
router.middleware.use(CORSMiddleware);
// router.middleware.use(CORSAuthorizationMiddleware);
// router.middleware.use(ForceWWWMiddleware);
// router.middleware.use(ForceHTTPSMiddleware);

/* Renderware */
/* executed *after* Controller-specific renderware */

const GzipRenderware = Nodal.require('renderware/gzip_renderware.js')

router.renderware.use(GzipRenderware);

/* Routes */

const IndexController = Nodal.require('app/controllers/index_controller.js');

/* generator: begin imports */


/* generator: end imports */

router.route('/').use(IndexController);

/* generator: begin routes */


/* generator: end routes */

module.exports = router;
github keithwhor / nodal / src / app / router.js View on Github external
/* executed *before* Controller-specific middleware */

const CORSMiddleware = Nodal.require('middleware/cors_middleware.js');
// const CORSAuthorizationMiddleware = Nodal.require('middleware/cors_authorization_middleware.js');
// const ForceWWWMiddleware = Nodal.require('middleware/force_www_middleware.js');
// const ForceHTTPSMiddleware = Nodal.require('middleware/force_https_middleware.js');

router.middleware.use(CORSMiddleware);
// router.middleware.use(CORSAuthorizationMiddleware);
// router.middleware.use(ForceWWWMiddleware);
// router.middleware.use(ForceHTTPSMiddleware);

/* Renderware */
/* executed *after* Controller-specific renderware */

const GzipRenderware = Nodal.require('renderware/gzip_renderware.js')

router.renderware.use(GzipRenderware);

/* Routes */

const IndexController = Nodal.require('app/controllers/index_controller.js');

/* generator: begin imports */


/* generator: end imports */

router.route('/').use(IndexController);

/* generator: begin routes */
github keithwhor / nodal / src / schedulers / main.js View on Github external
'use strict';

const Nodal = require('nodal');
const scheduler = new Nodal.Scheduler();

/* generator: begin imports */

const DummyTask = Nodal.require('tasks/dummy_task.js');

/* generator: end imports */

/* generator: begin tasks */

scheduler.minutely(30).perform(DummyTask);

/* generator: end tasks */


module.exports = scheduler;
github keithwhor / nodal / src / app / app.js View on Github external
module.exports = (function() {

  'use strict';

  const Nodal = require('nodal');

  /* Import Initializers */
  const StaticAssetInitializer = Nodal.require('initializers/static_asset_initializer.js');

  /* Import Middleware */
  const CORSMiddleware = Nodal.require('middleware/cors_middleware.js');

  /* Import Renderware */
  const GzipRenderware = Nodal.require('renderware/gzip_renderware.js');

  /* Import Router */
  const router = Nodal.require('app/router.js');

  /* Import Database */
  // const db = Nodal.require('db/main.js');

  /* Import Scheduler */
  // const scheduler = Nodal.require('schedulers/main.js');
github keithwhor / nodal / src / worker.js View on Github external
'use strict';

const Nodal = require('nodal');

const SchedulerMain = Nodal.require('schedulers/main.js');

SchedulerMain.start();
github keithwhor / nodal / src / app / controllers / static_controller.js View on Github external
module.exports = (function() {

  'use strict';

  const Nodal = require('nodal');
  const crypto = require('crypto');
  const fs = require('fs');

  const Error404Controller = Nodal.require('app/controllers/error/404_controller.js');

  class StaticController extends Nodal.Controller {

    get() {

      let filepath = this.params.matches[0];
      let ext = filepath.substr(filepath.lastIndexOf('.') + 1);
      filepath = filepath.replace(/(\.){1,2}\//gi, '');

      fs.readFile(`./static/${filepath}`, (err, buffer) => {

        if (err) {
          return Error404Controller.prototype.get.call(this);
        }

        this.setHeader('Content-Type', Nodal.Mime.lookup(ext) || 'application/octet-stream');

nodal

An API Server and Framework for node.js

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis