- Notifications
You must be signed in to change notification settings - Fork1
Example code for doing CORS requests to eLabFTW API
License
NotificationsYou must be signed in to change notification settings
elabftw/elabapi-javascript-example
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This example web page shows how to interact with an eLabFTW server through javascript. It requires configuring correctly the eLabFTW service to allow CORS requests.
In the docker-compose file (/etc/elabftw.yml
by default), add this:
# here the value must the of the service doing the request-ALLOW_ORIGIN=http://localhost:8087# comma separated list of methods (use GET, POST, PATCH, DELETE for full api access)-ALLOW_METHODS=GET-ALLOW_HEADERS=Content-Type, Authorization
Restart the service (elabctl restart
).
Run a local server with:
git clone https://github.com/elabftw/elabapi-javascript-examplecd elabapi-javascript-exampledocker run --rm -v${PWD}:/usr/share/nginx/html -p 8087:80 -d nginx
Modify the javascript code to point to your server with a valid API Key.
Go tohttp://localhost:8087 to try it out!
About
Example code for doing CORS requests to eLabFTW API
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Contributors2
Uh oh!
There was an error while loading.Please reload this page.