Skip to content

Commit

Permalink
Change app structure with create-react-app (#13)
Browse files Browse the repository at this point in the history
* Simplified app structure with create-react-app

* Modified pact to fetch id's, added filtering, edited fetch based on api edits

* Add toggleAll and classname on todoitem

* Changed readme, logo, added pact-lang-api.js

* Debug Edit

* Chained promises

* cleared log files

* cleared log files

* edit .gitignore

* delete build folder
  • Loading branch information
ggobugi27 authored Jun 20, 2019
1 parent 2552314 commit 0f62590
Show file tree
Hide file tree
Showing 28,938 changed files with 2,821,107 additions and 13,356 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
14 changes: 0 additions & 14 deletions .babelrc

This file was deleted.

18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
node_modules/
log/
.DS_Store
/coverage
node_modules
log
11 changes: 0 additions & 11 deletions .prettierignore

This file was deleted.

59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Pact Smart Contract Language TodoMVC demo

![](todos-pact.png)

## Setup

- Install Pact
- `brew install kadena-io/pact/pact`
- Install Node >= 8.11.4
- Install All Dependencies. The dependencies include [Pact Lang API](https://www.npmjs.com/package/pact-lang-api).
- `npm install`
- Navigate into pact-todomvc and create a log folder in the top-level folder `mkdir log`

## Scripts

`npm run start:pact`: Start the Pact Server

`npm run pact:seed`: Seed the blockchain

`npm start`: Start the Web Application

## Starting the Project

1. `npm run start:pact`
2. `npm run pact:seed`
3. `npm start`
4. `http://localhost:3000`

## Using the Pact Dev Server

### Configuration File

The pact dev server (pact-serve) requires a configuration Yaml file (e.g. server.conf) to operate. The documentation for it is:

```
➜ pact git:(feat/dev-server) pact --serve --help
Config file is YAML format with the following properties:
port - HTTP server port
persistDir - Directory for database files.
If ommitted, runs in-memory only.
logDir - Directory for HTTP logs
pragmas - SQLite pragmas to use with persistence DBs
verbose - [True|False] Provide extra logging information
```

### Initializing the server

When running pact-serve with persistence enabled the development server will automatically replay from disk when it starts.
In this demo, we are persisting to `log/` which causes pact-serve to create or use `log/commands.sqlite` to store Commands and CommandResults.

The first time you run pact-serve the SQLite DBs will be created empty (as no commands have been run yet).
To upload `todos.pact`, which the front end needs loaded to interact with, you run `initialize-todos.sh`.
The important thing to note is that until you delete `log/commands.sqlite` (or run pact-serve in memory) pact-serve will replay every command (e.g. load `todos.pact` -> UI interactions) on start up.

If you think of it like a blockchain, deleting the `commands.sqlite` file or running in memory gives Pact a "fresh" chain to work with.

## Credit

The front-end of this app was built on [React TodoMVC](http://todomvc.com/examples/react/#/) example.
2 changes: 0 additions & 2 deletions dist/1.index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/1.index.js.map

This file was deleted.

11 changes: 0 additions & 11 deletions dist/index.html

This file was deleted.

53 changes: 0 additions & 53 deletions dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

Loading

0 comments on commit 0f62590

Please sign in to comment.