I am building a new module using the official Ortus module-template as a starting place. I like that the template has almost everything scaffolded for developers, but I am a little unclear on the best way to use it when it comes to starting the server while building the app.
I see there are several preconfigured server.json files in the root of the project:
Each server config maps the web root to the “test-harness” folder like this:
"aliases":{
"/moduleroot/login":"../"
}
I can start the Lucee server by typing this into Commandbox:
server start server-lucee@5.json
The server starts as expected, but then Commandbox doesn’t show me that the server is running in the bullet train, nor can I get the status by typing server status
anymore. Because I used a custom config file, I need to use server status server-lucee@5.json
. While this works, it’s a lot more typing.
The second issue I have run into is that if I’m building a Coldbox module, I can no longer call fwreinit
or coldbox watch-reinit
because Commandbox doesn’t know where the web root is.
The shortcut workaround I’ve been using is to create a server.json file inside of the test-harness folder and use that as the root of my development server. The server.json looks like this:
{
"name":"my-awesome-module", <--- whatever you want to call the server
"app":{
"cfengine":"lucee@5"
},
"web":{
"http":{
"port":"55725" <-- select whatever port you want to use
},
"rewrites":{
"enable":"true"
},
"aliases":{
"/moduleroot/my-awesome-module":"../" <-- very important! points to the directory above test-harness
}
},
"openBrowser":"false",
"cfconfig":{
"file":"../.cfconfig.json" <-- use the cfconfig from the root of the project
}
}
What does the Ortus team do? Do they take the same shortcut I did and launch servers from the test-harness folder for easy access to Coldbox watch and reinit commands? Or is there a better way to handle this type of situation?