Lab_interaccio/2024/smartcitizen-kit-21-dev/mock-api
2025-02-25 21:29:42 +01:00
..
casperjs second commit 2025-02-25 21:29:42 +01:00
test second commit 2025-02-25 21:29:42 +01:00
.nvmrc second commit 2025-02-25 21:29:42 +01:00
api.json second commit 2025-02-25 21:29:42 +01:00
gulpfile.js second commit 2025-02-25 21:29:42 +01:00
karma.conf.js second commit 2025-02-25 21:29:42 +01:00
npm_test.sh second commit 2025-02-25 21:29:42 +01:00
package-lock.json second commit 2025-02-25 21:29:42 +01:00
package.json second commit 2025-02-25 21:29:42 +01:00
process.md second commit 2025-02-25 21:29:42 +01:00
README.md second commit 2025-02-25 21:29:42 +01:00
server.js second commit 2025-02-25 21:29:42 +01:00

Frontend + api setup

You can see the (master branch) mobile UI setup here

The technology used here is:

  • HTML, CSS, JavaScript
  • Vue.js

And the files are under esp/build_data

Here you can read about why we chose Vue.js and what the thought process was like.

Starting frontend development

Inside the ./mock-api folder do:

  1. npm install

  2. npm run web - Starts frontend on localhost:8000

  3. npm run api - Starts api on localhost:3000

  4. gulp watch - Watches changes and creates 2 files automatically; final.html and index.gz

Now you can start editing esp/build_data/build_index.html

If your mock-api is not responding, see /esp/build_data/main.js, theUrl should be (your API url:port)

Testing frontend

You can run End to End test (for the Web UI) against the current master branch with this command:

npm test

If you want the tests to be run automatically everytime you edit mock-api/casperjs/test use:

npm run autotest

Edit tests under mock-api/casperjs/test

UPDATE NEEDED!!

TODO / ideas:

  • Should we move the frontend to /mock-api, and create a process which compiles it + concatinates and puts the 'dist' in esp/data?
  • Instead of using a node.js mock-api, can we use the embedded C++ API of the kit somehow?