1 | # FoxHound
|
2 |
|
3 | The FoxHound javascript query generator, for node.js and the browser.
|
4 |
|
5 |
|
6 | ### Getting Started
|
7 |
|
8 | $ npm install foxhound --save
|
9 |
|
10 | Then...
|
11 |
|
12 | var foxhound = require('foxhound');
|
13 | var my_awesome_query = foxhound.scope('Users').cap(20).generate().query.body;
|
14 | console.log(my_awesome_query);
|
15 |
|
16 | The default query dialect is english, so, node should output:
|
17 |
|
18 | Please give me 20 of your Users. Thank you!
|
19 |
|
20 | This is not very useful for anything other than testing, so, we might want to change the dialect and try again:
|
21 |
|
22 | var foxhound = require('foxhound');
|
23 | var my_awesome_query = foxhound.scope('Users').cap(20).setDialect('MySQL').generate().query.body;
|
24 | console.log(my_awesome_query);
|
25 |
|
26 | Which now will output:
|
27 |
|
28 | SELECT * FROM Users LIMIT 20;
|
29 |
|
30 | ### Testing
|
31 |
|
32 | $ npm test
|
33 | $ npm run coverage
|
34 |
|
35 | ### Docker Development Environment
|
36 |
|
37 |
|
38 | 1. Run this command to build this image:
|
39 | ```
|
40 | docker build ./ -t retold/foxhound:local
|
41 | ```
|
42 |
|
43 | alternatively you can use npm to run this
|
44 |
|
45 |
|
46 | ```
|
47 | npm run docker-dev-build-image
|
48 | ```
|
49 |
|
50 | 2. Run this command to build the local container:
|
51 | ```
|
52 | docker run -it --name foxhound-dev -p 127.0.0.1:12346:8080 -v "$PWD/.config:/home/coder/.config" -v "$PWD:/home/coder/foxhound" -u "$(id -u):$(id -g)" -e "DOCKER_USER=$USER" retold/foxhound:local
|
53 | ```
|
54 |
|
55 | alternatively you can use npm to run this
|
56 |
|
57 | ```
|
58 | npm run docker-dev-run
|
59 | ```
|
60 |
|
61 | 3. Go to http://localhost:12346/ in a web browser
|
62 |
|
63 | 4. The password is "retold"
|
64 |
|
65 | 5. Right now you (may) need to delete the `node_modules` folders and regenerate it for Linux. |
\ | No newline at end of file |