- Express
- React
- Knex - Sqlite3
- Jest
- Redux
- SQLite/Postgres
- Auth0 - (in progress)
npm i- Create the example table
npm run knex migrate:latest- Add seed rows to the example table
npm run knex seed:runnpm run devAnd access it using a web browser Localhost
Build first
npm run buildThen run the server
npm start- Create a branch for each issue ticket from the dev branch
You can use the issue ticket number
e.g. devops-1, devops-1-configure-yml or 1-devops - Once the change is done
- Go to the dev branch
git checkout dev- Pull in the dev branch
git pull- Go back to the issue branch and start merging with dev
git merge dev- Handle all the conflicts
- Push from the issue branch
git push
- Crate a pull request
- After the pull request is approved and your branch is merged into dev,
either
- You can delete the branch safely
or - You can keep using it if you want
- React
- Webpack
- Babel
- React Components
- Node
- Express
- Server Side Routing
- test - testing using Jest
- dev - used for starting the client & server in the development environment
- dev-client - run webpack with watch option to create bundle.js
- dev-server - run server(Express)
- start - used for starting the server(Express) in the production environment
- build - run webpack without watch option to create bundle.js
- knex - used for running knex commands
The schema of the example table
| Column name | Type |
|---|---|
| id | integer |
| count | integer |
| title | string |
| description | string |
http://localhost:3000/#/example
This shows how to use form in React
This shows how to get data from the API end point using superagent
- A default route - Rendering using HBS
http://localhost:3000/examples
- A route accepts a parameter
http://localhost:3000/examples/param/<parameter>
- A route accepts a query string
http://localhost:3000/examples/query?key=<value>
- A route accepts post data - userId and content
<form action="http://localhost:3000/examples/posttest" method="post">
<input name="userId"/>
<input name="Content"/>
</form>URL to access the example end point which returns the records of the example table
http://localhost:3000/examples/api/
- Used libraries
- Jest is the core part
- Supertest for testing HTTP/API endpoints
- Cheerio: server side JQuery implementation
- Testing-library for testing UI components(React)
- Test file locations
- Client-side: client/tests
- Server-side: server/tests
- Running tests
npm run testClient side test shows how to conduct snapshot testing and UI testing
Client side example.test.js
Run the below command to update the snapshot
npm test -- -uServer side test shows how to use supertest and cheerio library for testing
Server side example.test.js
API testing API testing example-api.test.js
Heroku uses specific scripts named heroku-prebuild, heroku-postbuild and heroku-cleanup
- heroku-postbuild - This will be executed by Heroku after installation of dependencies and it will start the below two scripts
- build-knex - This will create tables
- build-webpack - This will build the webpack bundle file for client components
- heroku-cleanup - This will start any tasks needed after all the builds finished