Skip to content

Commit

Permalink
Reformat and further improve Local Environment Setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
scottsalvaggio committed Dec 9, 2020
1 parent f92bbee commit ae0b0b1
Showing 1 changed file with 34 additions and 37 deletions.
71 changes: 34 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,44 @@ All other content is released under [CC-BY-4.0](https://creativecommons.org/lice

### Local Environment Setup

```
- go into living-library
- npm install
- if it doesn't work the first time delete the node_modules folder and npm install
- have mysql 5.4 - 5.7
- add .env file in root folder (see .env-example)
- define the API_ROUTE and API_KEY variables in your .env file
- create a mysql database named "livinglibrary" (or whatever value you give to
the DB_NAME variable in your .env file)
- define the variables from the Database section of your .env file
- import livinglibrary.sql (schema only, no content; for schema & example
content, see livinglibrary_with_example_content.sql)
- define the variables from the "Tables from new database schema" section of
your .env file, which should match your mysql database
To run app over HTTPS:
- define the SSL_KEY and SSL_CERTIFICATE variables in your .env file
- run "node living-library.js"
- go to https://localhost:8000/API_ROUTE?api_key=API_KEY (i.e. HOST + API_ROUTE
+ "?api_key=" + API_KEY), where HOST, API_ROUTE, and API_KEY are defined in
your .env file
To run app over HTTP:
- In your .env file, make sure the HOST, API_URL, and CORS_ALLOWED_ORIGIN
variables begin with "http" rather than "https"
- In config/express.js, change:
const HTTPS = require('https')
to:
const HTTP = require('http')
and change:
* Go into `living-library` folder (i.e. root folder of app)
* Run `npm install`
* If it doesn't work the first time, delete the `node_modules` folder and rerun `npm install`
* Have mysql 5.4 - 5.7
* Add `.env` file to root folder of app (you can copy `.env-example`)
* Define the `API_ROUTE` and `API_KEY` variables in your `.env` file
* Create a mysql database named `livinglibrary` (or whatever value you give to
the `DB_NAME` variable in your `.env` file)
* Define the variables from the `# Database` section of your `.env` file (see `.env-example`)
* Import `livinglibrary.sql` (for schema only, no content) or
`livinglibrary_with_example_content.sql` (for schema & example content)
* Make sure the variables from the `# Tables from new database schema` section of
your `.env` file (see `.env-example`) match your mysql database

#### To run app over HTTPS:
* Define the `SSL_KEY` and `SSL_CERTIFICATE` variables in your `.env` file
* Run `node living-library.js`
* Go to `https://localhost:8000/API_ROUTE?api_key=API_KEY`
(i.e. `HOST + API_ROUTE + "?api_key=" + API_KEY`), where `HOST`, `API_ROUTE`,
and `API_KEY` are defined in your `.env` file

#### To run app over HTTP:
* In your `.env` file, make sure the `HOST`, `API_URL`, and `CORS_ALLOWED_ORIGIN`
variables have values that begin with `http` rather than `https`
* In `config/express.js`, change `const HTTPS = require('https')` to
`const HTTP = require('http')`.
Also, change
```
SERVER = HTTPS.createServer({
key: FS.readFileSync(CONFIG.sslKey),
cert: FS.readFileSync(CONFIG.sslCertificate)
}, APP);
to:
SERVER = HTTP.createServer(APP);
- run "node living-library.js"
- go to http://localhost:8000/API_ROUTE?api_key=API_KEY (i.e. HOST + API_ROUTE
+ "?api_key=" + API_KEY), where HOST, API_ROUTE, and API_KEY are defined in
your .env file
```
```
to `SERVER = HTTP.createServer(APP);`
* Run `node living-library.js`
* Go to `http://localhost:8000/API_ROUTE?api_key=API_KEY`
(i.e. `HOST + API_ROUTE + "?api_key=" + API_KEY`), where `HOST`, `API_ROUTE`,
and `API_KEY` are defined in your `.env` file

### Maintainers

Expand Down

0 comments on commit ae0b0b1

Please sign in to comment.