- Use node v20.9.0 (npm v10.1.0)
npm i
npm start
- Go to http://localhost:3000/formList and make sure you can see
<formID>submitmessage</formID>
in the list
-
Get a Redis running on ports 6379 and 6380. For example,
docker run --rm -it --publish 6379:6379 --publish 6380:6379 redis
-
Get the Yarn stuff sorted
-
Start Enketo; do not create
config.json
, but set this one thing to an empty string using an environment variable:ENKETO_LINKED_FORM_AND_DATA_SERVER_SERVER_URL= yarn workspace enketo-express start
You should see Enketo emit
No local config.json found. Will check environment variables instead.
when starting up.⚠️ These instructions assume you do not have aconfig.json
. If you do, please remove it or modify manually (latter is an exercise for the reader). -
Make sure http://localhost:8005/ says "Enketo Smart Paper for KoBoCAT is running!"
- Tell the Enketo API to use the
submitmessage
form from this server:curl --user enketorules: -d 'server_url=http://localhost:3000&form_id=submitmessage' http://localhost:8005/api/v2/survey
- You should receive a 201 response with a
url
like{ "url": "http://localhost:8005/some-identifier", "code": 201 }
- Open the browser's developer console; go to the network activity section
- Go to the http://localhost:8005/some-identifier URL returned above
- See a response from http://localhost:8005/transform/xform/some-identifier that contains
kobo:submitMessage
- Submit something
- See a response from http://localhost:8005/submission/some-identifier that contains
<message># Hello!
- HACK: This message is hard-coded in
app/controllers/submission.js
, not read from the submission
- HACK: This message is hard-coded in
A basic scaffolding of an ODK-compliant server for use with Enketo and ODK Collect.
No database - forms and submissions are stored as files.
implements:
future:
- NodeJS and npm
- install dependencies with
npm install
- build with
grunt
- place XForm in /storage/forms
- configure Enketo or ODK Collect to use this server
- run with
node .
ornpm start
- install nodemon
- run with
grunt develop
orNODE_ENV=development node app.js
- test with
grunt test