This template repository allows to create quickly a express server prepared for graphql and with passport local authentication
- Install dependencies
$ npm i
- Configure DB following this tutorial Configure DB
- Configure .env file (for example for local development)
DB_HOST=localhost PG_PORT=5432 PG_DB=$DBNAME PG_USER=postgres PG_PASSWORD=postgres SESSION_SECRET=somesecret PORT=3000 COOKIE_DOMAIN=
- Run server
$ npm start
In order to run server over https, it is necessary to include a server.cert
and server.key
in your root workspace. Automatically the server will run an HTTPS server in env.PORT + 1
These two files can be created with the following script
$ openssl req -nodes -new -x509 -keyout server.key -out server.cert
- List heroku apps
$ heroku apps
- Run script using
$ DATABASE_URL=$heroku config:get -a $APP_NAME DATABASE_URL)