Command line
When you run npm i -g waveorb you get the waveorb command available in your terminal. Run it without arguments or do waveorb help and you'll see a list of available commands:
create Create new app
boot Boot new app server
update Update app server
deploy Deploy app to server
serve Start app server
build Build app to dist
sitemap Create sitemap
ping Ping search engines
generate Generate templates
cmd Run command line console
migrate Run migrations
help Display this help text
Let's go through each of these and explain what they do.
Boot
Installing a server ready for Waveorb is incredibly easy. We have created a script that does it for you with all the bells and whistles:
- NodeJS LTS
- NGINX loadbalancer with gzip compression and HTTP2
- Automatic Certbot Let's Encrypt SSL
- Public Key authentication
- Firewall (UFW)
Read about how to boot a Waveorb server here.
Update
The waveorb update command simply updates the software on the VPS server. Typically run with npm run update.
Create
waveorb create creates a new app skeleton for you by downloading the waveorb templates and copying them to your hard drive. It takes two parameters:
# Specify the name
waveorb create myapp
The default application is a fully working app with pages, layouts, actions, assets and more. Read through the source code to see what you get. Remove the things you don't need.
Deploy
The waveorb deploy command deploys your Waveorb app on your server. Typically run with npm run deploy. To use this command you need to set up a waveorb.json file in your app's root directory:
{
"proxy": "http://localhost:31000",
"domains": "waveorb.com www.waveorb.com"
}
This will connect to the server where your domain name is pointing and attempt to deploy you app using those domains. If you are using server actions, you also need to set up a proxy URL which must have a port number unique to you application.
You can also set up redirects here:
{
"redirects": ["^/about$ https://waveorb.com"]
}
By default redirects are 301 permanent. Add redirect after to do a 302 temporary redirect:
{
"redirects": ["^/about$ https://waveorb.com redirect"]
}
To do redirects if your app has multiple domains, try this:
{
"domains": [
{
"names": "waveorb.com www.waveorb.com",
"redirects": ["^/about$ https://eldoy.com"]
},
{
"names": "eldoy.com"
}
]
}
Serve
waveorb serve starts the production server and is typically only used with npm run serve on the server after deploy.
Build
Running waveorb build will build static HTML pages of your app and copy your assets to the dist folder. It saves the response from a running app server based on the configuration in the build.js file, so make sure your server is running at the host you specify.
module.exports = async function() {
return {
// Specify the host, can be remote
host: 'http://localhost:5000',
// Specify the URLs you want to build
urls: [
'/',
'/about',
'/docs'
]
}
}
Here the value of host will be http://localhost:5000 when you're not building for example in development mode. When building, the value of host will be https://speria.no/api.
<script>window.api = waveorb('${host}')</script>
Sitemap
Running waveorb sitemap will generate the sitemap you have defined in app/config/sitemap.yml and copy it to the app/assets folder. Read more about sitemaps here.
Ping
The waveorb ping command will ping Google and Bing and let them know about your sitemap changes:
waveorb ping https://example.com/sitemap.xml
Generate
The waveorb generate command will generate actions and pages for a model. Let's say you want to create templates and actions for a model called project, then you run waveorb generate model project, and all the necessary files will be created for you automatically for that model.
You can specify command line fields to generate forms and action validations:
waveorb generate model project title:string description:text
and also use a file to describe and generate your application.
You can read more about generating here.
Cmd
Waveorb comes with its own terminal REPL. It is running the full NodeJS environment, and can be started with waveorb cmd. It supports top level await.
# Start the terminal REPL
waveorb cmd
Hit Ctrl + d or Ctrl + c twice to exit.