"Education content sharing platform, Study Buddies"
This is Study Buddies server
You can play in our graphql playground! :)
query {
helloWorld
}
- build:
yarn build
- run:
yarn dev
- playground:
http://localhost:3000/graphql
- lint:
yarn lint
- VScode extensions:
ESLint
,Prettier - Code formatter
- VScode setting:
formatOnSave: true
- add
.env
file to project root - add variables to
.env
For example,
MY_NAME=STUDY_BUDDIES
- add variables to
config.ts
and use this
export const MY_NAME = process.env.MY_NAME
env vars list
- GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET: google oauth login
- local mysql db config (run docker container)
- MYSQL_DATABASE=studybuddies
- MYSQL_USERNAME=root
- MYSQL_PASSWORD=1234
- MYSQL_HOST=127.0.0.1
- MYSQL_PORT=9876
- SERVER_BASE_URL: server endpoint
- CLIENT_BASE_URL: need for redirecting to client
- NODE_ENV: development or production
- COOKIE_SECRET: for storing session
Use local database until migrated.
Don't forget to sync your mysql setting and env vars in config.ts
- start
- run
docker-compose up -d
- sync the db and sequelize model:
yarn dev
(sequelize.sync
in server.ts automatically creates tables to db)
- end
- run
docker-compose down
yarn build
: first of all, check build is okdocker build -t studybuddies .
: build docker imagedocker run --publish 3000:3000 -d --name local studybuddies
: run docker container namedlocal
- create test db:
CREATE DATABASE studybuddies_test;
- update
.env
:MYSQL_DATABASE=studybuddies_test
- run
yarn test