Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Herokuize project #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
logfile

.env

node_modules/
dist/
node_modules/
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,24 @@ Client Applications:
* `npm install`
* fill out *.env file* (see below)
* start PostgreSQL database
* `npm start`
* `npm run dev`
* visit `http://localhost:8000` for GraphQL playground

## Deployment

Since we use modern javascript syntax, we need to perform a build step before
deploying to production. The compiled API is put in `lib/`.

* provision postgres database
* `npm run build`
* `npm start`

#### .env file

Since this boilerplate project is using PostgreSQL, you have to install it for your machine and get a database up and running. You find everything for the set up over here: [Setup PostgreSQL with Sequelize in Express Tutorial](https://www.robinwieruch.de/postgres-express-setup-tutorial). After you have created a database and a database user, you can fill out the environment variables in the *server/.env* file.

```
DATABASE=mydatabase
DATABASE_USER=postgres
DATABASE_PASSWORD=postgres
DATABASE_URL=postgres://username:password@localhost:5432/mydatabase
SECRET=asdlplplfwfwefwekwself.2342.dawasdq
```

Expand Down
70 changes: 55 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
"node": "10.11.0"
},
"scripts": {
"start": "nodemon --exec babel-node src/index.js",
"start": "npm run build && node lib/index.js",
"build": "babel src --out-dir dist",
"dev": "nodemon --exec babel-node src/index.js",
"heroku-postbuild": "npm run build",
"test:run-server": "TEST_DATABASE=mytestdatabase npm start",
"test:execute-test": "mocha --require @babel/register 'src/**/*.spec.js'",
"test": "echo \"No test specified\" && exit 0"
Expand All @@ -16,15 +19,15 @@
"author": "Robin Wieruch <[email protected]> (https://www.robinwieruch.de)",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.1.6",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.1.6",
"@babel/register": "^7.0.0",
"axios": "^0.18.0",
"chai": "^4.2.0",
"mocha": "^5.2.0",
"nodemon": "^1.18.7",
"morgan": "^1.9.1"
"nodemon": "^1.18.7"
},
"dependencies": {
"apollo-server": "^2.2.3",
Expand All @@ -38,6 +41,7 @@
"graphql-iso-date": "^3.6.1",
"graphql-resolvers": "^0.2.2",
"jsonwebtoken": "^8.4.0",
"morgan": "^1.9.1",
"pg": "^7.6.1",
"sequelize": "^4.41.2",
"uuid": "^3.3.2"
Expand Down