You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check [Express' Getting Started guide](https://expressjs.com/en/starter/basic-routing.html) to learn how to build a REST API in Express.
38
40
39
41
## Requirements
40
42
41
-
-**database link**: You need a link to the `database` which exposes a sparql endpoint on `http://database:8890/sparql`. In line with other microservices.
43
+
-**database link**: You need a link to the `database` which exposes a SPARQL endpoint on `http://database:8890/sparql`. In line with other microservices.
42
44
43
45
## Imports
44
46
45
47
The following importable variables are available:
46
48
47
-
-`app`: The application on which routes can be added
49
+
-`app`: The [Express application](https://expressjs.com/en/guide/routing.html) on which routes can be added
48
50
-`query(query) => Promise`: Function for sending queries to the triplestore
49
51
-`update(query) => Promise`: Function for sending updates to the triplestore
52
+
-`uuid()` => string: Generates a random UUID
53
+
-`sparql`: [Template tag](https://www.npmjs.com/package/sparql-client-2#using-the-sparql-template-tag) to create queries with interpolated values
50
54
51
55
You can either import specific attributes from the mu library, or import the whole mu object.
52
56
@@ -66,11 +70,15 @@ An example of importing the whole library:
66
70
res.send('Hello using full import');
67
71
} );
68
72
73
+
## Dependencies
74
+
75
+
You can install additional dependencies by including a `package.json` file next to your `app.js`. It works as you would expect: just define the packages in the `dependencies` section of the `package.json`. They will be installed automatically at build time.
76
+
69
77
## Developing with the template
70
78
71
-
When developing, you can use the template image, mount the volume with your sources on `/app` and add a link to the database.
79
+
When developing, you can use the template image, mount the volume with your sources on `/app` and add a link to the database. The service will live-reload on changes. You'll need to restart the container when you define additional dependencies in your `package.json`.
0 commit comments