Make endpoint specific for mappings

Change-Id: I3207d1aef25a5bef8f844f19b4306b135c8db3ff
diff --git a/README.md b/README.md
index a9835a4..c28f50b 100644
--- a/README.md
+++ b/README.md
@@ -142,8 +142,9 @@
 - [x] Mapping functionality
 - [x] Support for rewrites
 - [x] Web service
-- [ ] Support for negation
 - [x] JSON script for Kalamar integration
+- [ ] Support for negation
+- [ ] Support multiple mappings (by having a check list)
 - [ ] Response rewriting
 - [ ] Integration of mapping files
 
diff --git a/cmd/termmapper/main.go b/cmd/termmapper/main.go
index 60dc0a0..ec8b93d 100644
--- a/cmd/termmapper/main.go
+++ b/cmd/termmapper/main.go
@@ -35,6 +35,7 @@
 	Description string
 	Server      string
 	SDK         string
+	MapID       string
 	MappingIDs  []string
 }
 
@@ -127,6 +128,7 @@
 
 	// Kalamar plugin endpoint
 	app.Get("/", handleKalamarPlugin(yamlConfig))
+	app.Get("/:map", handleKalamarPlugin(yamlConfig))
 }
 
 func handleTransform(m *mapper.Mapper) fiber.Handler {
@@ -228,6 +230,8 @@
 
 func handleKalamarPlugin(yamlConfig *config.MappingConfig) fiber.Handler {
 	return func(c *fiber.Ctx) error {
+		mapID := c.Params("map")
+
 		// Get list of available mapping IDs
 		var mappingIDs []string
 		for _, list := range yamlConfig.Lists {
@@ -247,6 +251,7 @@
 			Description: config.Description,
 			Server:      server,
 			SDK:         sdk,
+			MapID:       mapID,
 			MappingIDs:  mappingIDs,
 		}
 
@@ -272,26 +277,29 @@
 <body>
     <div class="container">
         <h1>` + data.Title + `</h1>
-		<p>` + data.Description + `</p>
-        
-        <h2>Plugin Information</h2>
+		<p>` + data.Description + `</p>`
+
+	if data.MapID != "" {
+		html += `<p>Map ID: ` + data.MapID + `</p>`
+	}
+
+	html += `		<h2>Plugin Information</h2>
         <p><strong>Version:</strong> <tt>` + data.Version + `</tt></p>
 		<p><strong>Build Date:</strong> <tt>` + data.Date + `</tt></p>
 		<p><strong>Build Hash:</strong> <tt>` + data.Hash + `</tt></p>
 
         <h2>Available API Endpoints</h2>
         <dl>
-            <dt><tt><strong>POST</strong> /:map/query?dir=atob&foundryA=&foundryB=&layerA=&layerB=</tt></dt>
-            <dd><small>Transform JSON objects using term mapping rules</small></dd>
-            
-			<dt><tt><strong>GET</strong> /health</tt></dt>
-            <dd><small>Health check endpoint</small></dd>
 
-			<dt><tt><strong>GET</strong> /</tt></dt>
-            <dd><small>This entry point for Kalamar integration</small></dd>
+		    <dt><tt><strong>GET</strong> /:map</tt></dt>
+            <dd><small>Kalamar integration</small></dd>
+			
+            <dt><tt><strong>POST</strong> /:map/query</tt></dt>
+            <dd><small>Transform JSON query objects using term mapping rules</small></dd>
+			
         </dl>
-
-        <h2>Available Term Mappings</h2>
+		
+		<h2>Available Term Mappings</h2>
 	    <ul>`
 
 	for _, id := range data.MappingIDs {
@@ -300,14 +308,15 @@
 	}
 
 	html += `
-    </ul>
+    </ul>`
 
-    <script>
+	if data.MapID != "" {
+		html += `   <script>
   		<!-- activates/deactivates Mapper. -->
   		  
        let data = {
          'action'  : 'pipe',
-         'service' : 'https://korap.ids-mannheim.de/plugin/termmapper/query'
+         'service' : 'https://korap.ids-mannheim.de/plugin/termmapper/` + data.MapID + `/query'
        };
 
        function pluginit (p) {
@@ -323,8 +332,10 @@
            };
          };
        };
-    </script>
-  </body>
+    </script>`
+	}
+
+	html += `  </body>
 </html>`
 
 	return html