Comments (1)
Hi @tkambler.
So sorry this fell off my radar.
So there are a couple of things going on here. First, one thing that meddleware does and, second, one thing that confit does (a module you're using if you're building a kraken-js app). In the example you provided, the second case is what's happening but I'll explain both for posterity.
The Thing that Meddleware Does™
Meddleware has a shorthand syntax for supplying the module. If you don't need to supply a method name or arguments (in other words, when the module name is sufficient), meddleware accepts a string module name for the module
property. In other words, these two are equivalent:
{ "router": "./myFancyRouter" }
// ... is equivalent to ...
{
"router": {
"name": "./myFancyRouter"
}
}
The Thing that Confit Does™
Confit is the environment-aware configuration loader we wrote for kraken-js. Each layer of configuration is loaded on top of each previous layer. Objects from the new layer are merged into objects of the old layer.
Two of the config files that confit loads are config/config.json
, followed by config/[env].json
([env]
replaced with the NODE_ENV
in which your app is run). You can think of the config.json
as your base config, and the [env].json
as the overlaid config that is merged into your base config. Given these files:
// config/config.json
{
"middleware": {
"router": {
"module": {
"name": "express-enrouten",
"arguments": [{ "index": "path:./routes" }]
}
}
}
}
// config/dev.json
{
"middleware": {
"router": {
"module": {
"arguments": [{ "directory": "path:./controllers" }]
}
}
}
}
... your final config will look like this:
{
"middleware": {
"router": {
"module": {
"name": "express-enrouten",
"arguments": [{ "directory": "path:./controllers" }]
}
}
}
}
... in the case of a kraken-js app, there is a root config that gets loaded before your config/config.json
and the example above is almost exactly the same. All of the root level configs are documented in the kraken-js readme.
Let me know if anything else in unclear or if you have any other questions about this. Again, sorry for the delay!
from meddleware.
Related Issues (20)
- Route on middleware not working HOT 6
- Backport route regex support for v1.x?
- Events not fired properly HOT 5
- normalize the config `module` property
- add array support for the `route` property HOT 1
- `mountpath` isn't always a string HOT 4
- Enabled toggle in flow controlled sections changed HOT 3
- `util#mapValues` `prop.name` won't ever exist
- Meddleware 4.0 not working as expected HOT 9
- Passing object to middleware HOT 1
- Can we support async middleware factories? HOT 5
- Register middleware based on HTTP method HOT 3
- Deprecate RQ for parallelism HOT 1
- Why is the configuration an object instead of an array of objects?
- edge case bug in the local path resolver HOT 1
- npm5 issue HOT 1
- How can I have an environment-controllable value that defaults to true? HOT 3
- meddleware broken with config v.3.0
- if modulePath is undefined, the require might resolve relative path from config wrongly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meddleware.