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 topicsTopics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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](https://git.learnjsthehardway.com/learn-javascript-the-hard-way/ljsthw-bandolier#ljsthw-bandolier). This is where the code really lives.
That will create a command you'll use to manage installs and updates of the [Bandolier Template](https://git.learnjsthehardway.com/learn-javascript-the-hard-way/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](https://git.learnjsthehardway.com/learn-javascript-the-hard-way/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.
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: