javascript - Static API Documentation with embedded API key -


I am setting up an API document for a project, and want to know what is the best tool for a job ..

The site is completely stable Skip for API keys , which I would like to include in code examples based on user (if the user receives their own API key Is' logged in again).

How can I get it while maintaining a static site (I'm using a static-site generator).

I would recommend to include small AJAX scripts on all pages, which search through the page -and-replace

On a static page, you will have a code like this:

  & lt ;! - Empty span in page template - & gt; & Lt; Span class = 'api-key' & gt; & Lt; / Span & gt;  

Everywhere you want to embed the API key The script will execute the simple task of search-and-replace (pseudocode is like this, assuming that jQuery is on your page):

  $ (document) .ready (function () {$ .get ("/ Api / key", function (data) {/ * if necessary, supply certificate * / $ ('.api-key') .html (data);}});  < / Pre> 

Hope this helps.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -