- express backend
- mogoose + mongodb ( users collection )
- react ( create react app )
- user onbaording and authentication flow.
- server and client error handling.
- Travis CI + tests flow
- express test flow with Jest + coveralls
- react tests + coveralls
url tbd.
- create git repo
- create heroku app + mLab addon
- add repo to coveralls.io
- on heroku dashboard create an env var for COVERALLS_REPO_TOKEN with your token.
- commit and push (directly to heroku or using a pipeline from github)
- follow steps 1-5.
- DB schemas should be added to
models/CollectionName.js
- ❗️ Add
.env
file to to root project folder in order to add env vars locally (being read at index.js)
-
🚀 index.js : entry point, set up dev env vars and other config before starting server, run server.
-
💻 server.js parts by order (mainly):
- express
- mongoose
- session storage (for user authentication) + hanler in scripts.
- request body parsing middlewere (json, urlencoded)
- serving static files
- routes
- serve react app (last result to pick up request)
- error handling middleware (handler in scripts)
- connection to db
- listen to port (server starts)
-
🗄 Models folder: collections
- App: entry point, user state, passes to relevant components.
- Navbar container: logs every render, user onboarding bottons.
- components/protectedRoute: renders the protected page only if there is a user in the sate.
- login: class components, ..logs in users
- heroku
- Jest (client and express tests)
- travis
- coveralls
- will show coverage report of both client tests and server tests (they run seperatly).
-
Jest is used for both client and express.
-
Run tests from root folder: * on express server
npm run test
- with run with cover report:
npm run coveralls
* client tests locally: cd client && npm run test
-
todo: api routes with Supertest.
-
todo: components test with enzyme.
-
coverage reports with coveralls.
- tests are run by travis from the
.travis.yml
file.