Aden CLI, API and Configuration
Aden conveniently wraps the wall of configuration for webpack and the ever repeating route/controller setup for express, removing a lot of cognitive overhead. You can still do all the things though.
The Root
Your root folder is where your application is located, that Aden should handle for you.
Environment
Aden does not care about NODE_ENV. She has two possible runtime modes though, which are development or production. If you want to run tests, configure your application with environment variables accordingly and start the development or production server, whichever you want to test.
// TODO: Example how to register an environment variable config key
TODO: Link to example operations docs generation --ops
The .server
File
All application specific settings should be environment variables, which always overrides the corresponding setting from the .server
config. Values from the .server
config can therefor be used to bootstrap a development environment, but will not be used in production mode.
Routing
Aden does not just serve files out of a static file system, she actually generates a webpack configuration and it builds your frontend assets to be served statically. Furthermore it allows extending the server with controllers to provide serverside rendering or an API.
You can still use route parameters like /user/:id
, on unix filesystems, directly in the path if you like. On windows filesystems you can use /user/+id
to the same effect.
You can also add globbing via the /user/.server
config like:
{
"route": "/:id",
}
Which will now only match /user/:id
. If you want to include the path route, you can use { "route": ["/", "/:id"] }. In your /user/.get.js
you can now do whatever you would do in an express controller, like:
module.exports = () => (req, res) => res.send(req.params.id);
Status Pages
Aden currently handles the 404
and 500
response states with custom pages, which behave just like any page. By default, pages with the names 404 and 500 in the page graph, will be hooked up as status pages.
mkdir 404
touch index.html
echo error file not found > index.html