**This requires a [relatively modern version](https://nodejs.org/en/download/current/) of Node that supports async/await and ES6 (v13.x+). Tested using v13.3.0. Do not use LTS builds.** You may still get `(node:61412) ExperimentalWarning: The ESM module loader is experimental.`. Ignore this as ESM is essentially stable in recent versions.
Create a database named `psforever` using `psql` or a graphical tool such as [pgAdmin](https://www.pgadmin.org/download/) (highly recommended).
Then create a user named `psforever` with a password of `psforever` and `GRANT` it access to the `psforever` database, public tables, and public sequences.
This can be summarized with the following raw SQL commands:
```sql
CREATE USER psforever;
CREATE DATABASE psforever;
GRANT ALL PRIVILEGES ON DATABASE psforever TO psforever;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO psforever;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO psforever;
ALTER USER psforever WITH PASSWORD 'psforever';
```
Load the DB schema into the database using the command line:
(node:25327) ExperimentalWarning: The ESM module loader is experimental.
WARNING: development server simulated delay active
Connected to the psql database at localhost
[MODE development] PSFWeb now accepting requests at http://localhost:8080/
```
Please note that Webpack (dev) will proxy all API requests (/api) to the host `http://localhost:8080` (see the `devServer` key in [webpack.config.cjs](webpack.config.cjs)). This MUST match your backend server's (dev-server) listening port, which is by default 8080.
**Finally, connect to http://localhost:8081** (webpack, not the raw express server)
1. Database SELECT/INSERTs are failing, but I can connect to the DB
Make sure you have granted the right permissions to your DB user.
```
GRANT ALL PRIVILEGES ON DATABASE user TO dbname;
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO user;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO user;
```
2.`[HPM] Error occurred while trying to proxy request /api/stats from localhost:8080 to http://localhost:8080`
Your Webpack instance is listening on 8080, when it should be listening on 8081 and proxying to the express server at 8080. Make sure to run `npm run dev-server` first and make sure it ran properly.
3.`Error: Cannot find package 'bcrypt'`
The `bcrypt` package has native dependencies that must match your Node version. If you upgrade Node, they will be outdated. To fix this, you need to remove your `node_modules/` directory and run `npm install` again to kick off another native build of this dependency.