This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Zed A. Shaw a5d8215d43 Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
admin Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
api Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
client Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
commands Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
emails Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
lib Discord wasn't aborting correctly when the key wasn't configured. Livestream test still used an old schema. Configs needed to be updated in commands/templates 2 years ago
migrations Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
queues Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
rendered Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
scripts Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
socket Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
static Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
tests Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
.gitignore Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
LICENSE Initial commit 2 years ago
README.md Bring over the words from ljsth-bandolier to keep it consistent. 2 years ago
bando.js Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
bando.ps1 Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
build.json Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
build.prod.json Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
knexfile.cjs Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
nodemon.json Initial big commit that brings over all of the latest development from my sites. This will be refined and released soon, but right now I'm testing how it installs with ljsthw-bandolier's installer. 2 years ago
package-lock.json Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago
package.json Upgrading to node 18 LTS. Seems the only major change is a few new security defects in the qs library, and defaulting to IPv6 in some cases. 2 years ago

README.md

bandolier-template

The Bandolier is an educational web framework featured in the Learn JavaScript the Hard Way course. The Bandolier contains all of the features a full stack developer would need to learn, but with smaller easier to understand implementations that are fully visible in the project.

This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.

Installation

First, install the ljsthw-bandolier:

npm install git+https://git.learnjsthehardway.com/learn-javascript-the-hard-way/ljsthw-bandolier.git

That will create a command you'll use to manage installs and updates of the Bandolier Template. The code for the framework lives there.

You should now be able to do this:

npx bando-up --version
npx bando-up --help

If you can't then refer to the documentation for ljsthw-bandolier, especially if you get errors regarding SSL certificates on Windows.

If you can run the npx bando-up command then use it to create your first project:

npx bando-up create my-project

This will checkout the Bandolier Template git repository into the my-project directory. Once it's done you can move on to Configuration.

Configuration

If you checked out your first project into my-project then do this:

cd my-project
npm install

That will move you into the project directory and install all of the required software. If you get errors with node-gyp see below on how to fix them (maybe).

Once npm install finishes you can configure the application:

npm run knex migrate:latest

This will setup your database, and then you can finally do the initialize command to finish the setup:

node bando.js init

This will configure some items, rerun the migrations just in case, and copy any template files that may have been missed. It will skip files you already have, and then wait for you to start the app in another window.

Open another Terminal window and start the app in DANGER_ADMIN mode:

npm run DANGER_ADMIN

This starts the app in developer mode, but it's called DANGER_ADMIN so you know for sure you should not be running it this way in production on the internet.

Once it's running, switch back to the other window and hit ENTER. This will open your browser to http://localhost:5001 so you can register a first user. Fill out the registration form with a fake user and hit the Register and Continue to Payment button.

When your developer user is first registered it's not an administrator. Switch back to the window running node bando.js init and hit ENTER again. The command will then set the first user to admin=1 and report FINISHED!.

The final test is switch back to the browser and refresh the page to see that you are now administrator.

The bando.js Script

If you're on OSX or Linux you can just run ./bando.js directly rather than node bando.js. If you're on Windows you can use the PowerShell script ./bando instead. To make these instructions work for people who skim I'm using node bando.js.

This command is a simple "runner" script that looks in the directory commands for all .js files to provide them as commands. You can go in there right now and look at the commands/init.js file to see what it did. The code is fairly simple, and a good one to study first. Feel free to look at the other commands as well.

More to Come

That's the end of the first docs. There will be more work to clean this code up and test it by implementing various sites as demonstrations. Give it a tour and feel free to ask questions you may have.

Install Error with Playwright

In theory you shouldn't need playwright to download browsers, so just tell it not to.

PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 npm install

This isn't as needed on Linux as OSX, because the Playwright project forces people to upgrade their OS by claiming all versions of their project can't support any slightly older Safari versions. You also just don't need Safari, so skip the download.

If this doesn't work then this might https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md which says that npm updates don't update the node-gyp it uses internally. Depending on your version you will have to run different commands, but this works for 7,8, and 9 versions:

npm explore npm/node_modules/@npmcli/run-script -g -- npm_config_global=false npm install node-gyp@latest

There's also an issue with installing node-pre-gyp where it seems you need to install @mapbox/node-pre-gyp and also node-pre-gyp.