![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Simply due lack of a better name 'Epiphany' was chosen. It has no meaning and is pretty ambiguous. Sorry.
Epiphany is a library that aims to greatly speed up the creation of simple websites with Node & Express. Epiphany is the result of realising the only important thing for an Express server is its routes. Thus, Epiphany intends to simplify setting up routes.
On top of basic Express setup Epiphany contains predefined middleware that can be required and used at will. It also contains several schemas for quick implementation of database models follwing schema.org specifications.
Epiphany is currently intended to be used with:
In index.js
, the /modules
directory in the root project is added (using
app-module-path]) to the array
of paths search for node modules in require()
. This is to make it easier
to require modules from both Node and Browserify (the same path should thus also
be added to your Browserify/Web-pack config).
Epiphany will setup two globals if they are not already set, namely PWD and ENV.
If you want to edit the prewares and/or postwares (or anything else for that
matter) before starting the Express instance, pass { start: false }
to the
Epiphany constructor, then call epiphany.start()
when you are ready.
There is a /sample-config
directory that contains example configuration files.
These should be copied into your project's /server/config
directory and edited
to suit your needs.
Preware are middleware functions loaded before the routes, and postware is loaded after all route specific middleware. Both are path-less, ie they are set up simply using
express.use([ middleware ]);
The prewares and postwares can be edited by manipulating the epiphany.prewares
and epiphany.postwares
arrays respectively. This needs to be done before starting the Epiphany instance.
this.prewares = [
express.static(this.config.dir.static, ENV === 'production' ? { maxAge: '1 year' } : null),
express.static(this.config.dir.uploads, ENV === 'production' ? { maxAge: '1 year' } : null),
bodyParser.json(),
bodyParser.urlencoded({ extended:true }),
cookieParser(),
session(this.config.session)
];
this.postwares = [
require('./middleware/ensure-found'),
require('./middleware/error-handler'),
require('./middleware/responder'),
require('./middleware/responder-error'),
];
A route is defined by an array with a path, an HTTP/Express method name and a middleware or an array of middleware.
Example:
var routes = [
[ '/', 'get', mw.index ],
[ '/admin', 'get', [ mw.isAuthenticated, mw.admin ]
];
These are setup in epiphany.start()
with
var path = arr[0],
method = arr[1],
middleware = arr[2];
this.express[method](path, middleware);
One can use epiphany.module(module)
to easily extend Epiphany. An Epiphany
module is simply a plain object containing an array of routes, dust filters and/or
dust helpers.
Example module:
modul.exports = {
routes: [
[ '/ball-sack', 'get', mw.fetchBallSack ]
],
filters: {
camelCase: function(value) {
return _.camelCase(value);
}
},
helpers: {
contains: function(chunk, context, bodies, params) {
return _.contains(params.array, params.value) ? chunk.render(bodies.block, context) : chunk;
}
}
};
Adding modules should always be done before starting the instance.
Epiphany (and most other server-side modules from TCB) uses the excellent Debug plugin.
To debug everything, simply set DEBUG=epiphany
as an environment variable. To debug
specific parts, set (for example) DEBUG=epiphany:loaders
. Debuggable parts are currently:
// set up some globals (these are also set in Epiphany if not already set)
global.ENV = process.env.NODE_ENV || 'development';
global.PWD = process.env.PWD || process.cwd();
// modules > native
var p = require('path');
// modules > 3rd party
var requireDir = require('require-dir');
var passport = require('passport');
var server = new (require('epiphany'))({
config: requireDir('./config', { camelcase: true }),
pages: {
'/admin': require('./pages-admin'),
'/': require('./pages-public'),
},
routes: require('./routes'),
modules: [
require('dust-admin'),
// hats > hats
require('hats/membership'),
require('hats/contact'),
require('hats/content'),
require('hats/errors'),
require('hats/organization'),
require('hats/news'),
require('hats/employees'),
require('hats/image-upload'),
],
start: false,
});
// set up passport and membership prewares and postwares
server.prewares.push(passport.initialize(), passport.session());
server.postwares.unshift(require('hats/membership/middleware/authorization').redirectUnauthorized('/login'));
if(ENV === 'development')
server.prewares.push(require('epiphany/middleware/automatic-login'));
_.extend(server.express.locals, {
site: require('./config/site'),
lang: process.env.NODE_LANG || 'en'
});
// set organization from database to express.locals
require('hats/organization/middleware').get(null, { app: server.express }, null);
server.start();
FAQs
I just got one.
The npm package epiphany receives a total of 1 weekly downloads. As such, epiphany popularity was classified as not popular.
We found that epiphany demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.