{"id":11119,"date":"2018-05-24T11:18:37","date_gmt":"2018-05-24T09:18:37","guid":{"rendered":"http:\/\/flaven.fr\/?p=11119"},"modified":"2026-09-16T10:07:36","modified_gmt":"2026-09-16T08:07:36","slug":"node-api-postman-buid-a-simple-but-complete-rest-api-with-node-tested-with-chai-and-newman-documented-with-apidoc","status":"publish","type":"post","link":"https:\/\/flaven.fr\/2018\/05\/node-api-postman-buid-a-simple-but-complete-rest-api-with-node-tested-with-chai-and-newman-documented-with-apidoc\/","title":{"rendered":"Node, API, Postman &#8211; Build a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc"},"content":{"rendered":"<p>These latest months, I have made a lot of research on Testing an API. I dug deep into Mocha, Chai, Postman and Newman. I have also taken a large breath and dived into the Node&#8217;s world as it is the quickest way to build an API.<br \/>\nThe idea of this post, it is to strengthen the ability for non-developer to structure a POC for an API with the maximum of accuracy. <\/p>\n<p>I believe that, especially for a non-developer such as PO for instance, there is a strong correlation between testing new features and improving the design process of a product. How can I as a PO add a new feature to my product for instance a mobile application if I am not able to test it correctly. Indeed, the test implies that have a clear idea of what the new feature has to do. If I am unable to test it by writing down a gherkin feature, I am probably unable to express my need. My other concern was also how can I spark off my interest for testing, overcome the difficulty to learn Chai for instance and embrace the culture of testing.<\/p>\n<p><b>The code is available on github at <a href=\"https:\/\/github.com\/bflaven\/node-countries-light-app\" target=\"_blank\">https:\/\/github.com\/bflaven\/node-countries-light-app<\/a><\/b><\/p>\n<p>As I am not considering myself as a developer, I always pay a lot of attention of what is implicit in the given explanations of a post dedicated for instance on how build a Node API. Most of the posts that have read are stuffed with useful but implicit information. Here is the reason why I am making this quick digest of its, avoiding as far as I can plagiarism and  adding  2 plus : a test strategy and a way to handle documentation with Apidoc.<\/p>\n<p>Be sure before you start, to ensure that you have npm and mongo installed. Just go in the console and type the following commands.<\/p>\n<pre lang=\"bash\">$ npm -v<\/pre>\n<pre lang=\"bash\">$ mongo --version<\/pre>\n<pre lang=\"bash\">$ node -v<\/pre>\n<p><b>If Homebrew, Node or Mongo are not installed. Here the shortest procedure to install all requirements on a Mac. Very brief but you got the essentials, if you have already installed these tools, you can jump to the point 1.<\/b><\/p>\n<ul>\n<li>Install Postman: Check https:\/\/www.getpostman.com\/apps<\/li>\n<li>Install Homebrew: Check https:\/\/brew.sh\/. Launch in the console:\n<pre lang=\"sh\">$ \/usr\/bin\/ruby -e \"$(curl -k -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"<\/pre>\n<\/li>\n<li>Install Node and NPM:\n<pre lang=\"sh\">\r\n  $ brew update\r\n  $ brew doctor\r\n  $ export PATH=\"\/usr\/local\/bin:$PATH\"\r\n  $ brew install node\r\n<\/pre>\n<p> Source: <a href=\"https:\/\/changelog.com\/posts\/install-node-js-with-homebrew-on-os-x\" target=\"_blank\">https:\/\/changelog.com\/posts\/install-node-js-with-homebrew-on-os-x<\/a>\n<\/li>\n<li>Install Newman globally:\n<pre lang=\"sh\">\r\n  $ npm install -g newman\r\n<\/pre>\n<p>. Source: <a href=\"https:\/\/support.getpostman.com\/hc\/en-us\/articles\/115003703325-How-do-I-install-Newman-\" target=\"_blank\">https:\/\/support.getpostman.com\/hc\/en-us\/articles\/115003703325-How-do-I-install-Newman-<\/a><\/li>\n<li>Install MongoDB:\n<pre lang=\"sh\">\r\n$ brew update\r\n$ brew install mongodb\r\n<\/pre>\n<p>At the root of your computer, create the default directory*. <\/p>\n<pre lang=\"sh\">\r\n  $ mkdir -p \/data\/db\r\n<\/pre>\n<p><i>* Run without specifying paths: If your system PATH variable includes the location of the mongod binary and if you use the default data directory (i.e., \/data\/db), simply enter mongod at the system prompt: <code>mongod<\/code><\/i>.<\/p>\n<p>Source: <a href=\"https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-os-x\/\" target=\"_blank\">https:\/\/docs.mongodb.com\/manual\/tutorial\/install-mongodb-on-os-x\/<\/a><\/li>\n<\/ul>\n<h4>1. SETTINGS<\/h4>\n<p>First of all, the content that the API decide on a semantic point of view what you are going to use in terms of wording both for the MVC of your Node application and the database for mongodb. In my case, I am working with countries, so I may need to use for the MVC something like country!<\/p>\n<p><b>As you will a create a countries dedicated to countries, be sure to thing of using <code>country<\/code> or <code>countries<\/code> as &#8220;prefix&#8221; as much as possible  and so On<\/b><\/p>\n<p>Here is future name of for my coming controller, model, route: <code>country.controller.js<\/code>, <code>country.model.js<\/code>, <code>country.routes.js<\/code><\/p>\n<p><b>Here the name for the database in mongodb: countries_light_app<\/b><br \/>\n<b>The directory and appName: node-countries-light-app<\/b><\/p>\n<h4>2. CREATING A SIMPLE APP <\/h4>\n<p><b>To ensure that you are in the correct directory of the app<\/b> <\/p>\n<pre lang=\"bash\">$ pwd<\/pre>\n<pre lang=\"bash\">$ cd \/[path-in-your-environment]<\/pre>\n<pre lang=\"bash\">$ mkdir node-countries-light-app<\/pre>\n<pre lang=\"bash\">$ cd node-countries-light-app<\/pre>\n<p><b>In the application directory <code>node-countries-light-app<\/code><\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/001_node_api_testing_npm_init.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Launch the installation with npm, by default this will load the content of package.json<\/b><\/p>\n<pre lang=\"bash\">$ npm install<\/pre>\n<p><b>In the console, go the directory where you want to create your app directory <code>node-countries-light-app<\/code><\/b><\/p>\n<p>You will define the characteristics of your application and then you will get the famous package.json file with the basics information of your node application.<\/p>\n<ul>\n<li>The value for the name: <code>node-countries-light-app<\/code><\/li>\n<li>The value for the description: <code>Yallah Yallah, Welcome to Country Light App. A prototype to play with Countries.<\/code><\/li>\n<li>The values for the keywords: <code>Node, Express, RestAPI, MongoDB, Mongoose, Countries<\/code><\/li>\n<\/ul>\n<p><b>Be sure to be in your application directory <code>node-countries-light-app<\/code> and type this command.<\/b><\/p>\n<pre lang=\"bash\">$ npm init<\/pre>\n<p><b>After a simple step by step, you should get a package.json created with npm init like this one below:<\/b><\/p>\n<pre lang=\"json\">\r\n{\r\n  \"name\": \"countries-light-app\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"Yallah Yallah, Welcome to Country Light App. A prototype to play with Countries\",\r\n  \"main\": \"server.js\",\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\r\n  },\r\n  \"keywords\": [\r\n    \"Node\",\r\n    \"Express\",\r\n    \"RestAPI\",\r\n    \"MongoDB\",\r\n    \"Mongoose\",\r\n    \"Countries\"\r\n  ],\r\n  \"author\": \"bflaven\",\r\n  \"license\": \"ISC\"\r\n}\r\n<\/pre>\n<p><b>Creating the package.json<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/002_node_api_testing_npm_init_start.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Creating the package.json<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/003_node_api_testing_npm_init_end.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Install the Node elements that are required to make your application working<\/b><\/p>\n<pre lang=\"bash\">$ npm install express body-parser mongoose --save<\/pre>\n<p><b>Your application directory <code>node-countries-light-app<\/code> now has a package.json file and a node_modules folder and should look like this:<\/b><\/p>\n<pre lang=\"bash\">\r\nnode-countries-light-app\/\r\n|-- _node_modules\/\r\n    |-- ...    \r\n|-- package.json\r\n<\/pre>\n<p><b>Launching the install<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/004_node_api_testing_npm_install.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Launching the install<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/005_node_api_testing_npm_install_end.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Create the server file for your Node application<\/b><\/p>\n<pre lang=\"bash\">\r\n$ touch server.js\r\n<\/pre>\n<p><b>Insert this code into the file <code>server.js<\/code><\/b><\/p>\n<pre lang=\"javascript\">\r\n  \/* server.js V1 *\/\r\nconst express = require('express');\r\nconst bodyParser = require('body-parser');\r\n\r\n\/\/ create express app\r\nconst app = express();\r\n\r\n\/\/ parse requests of content-type - application\/x-www-form-urlencoded\r\napp.use(bodyParser.urlencoded({ extended: true }))\r\n\r\n\/\/ parse requests of content-type - application\/json\r\napp.use(bodyParser.json())\r\n\r\n\/\/ define a simple route\r\napp.get('\/', (req, res) => {\r\n    res.json({\"message\": \"Yallah, Welcome to Country Light App. A prototype to play with Countries\"});\r\n});\r\n\r\n\/\/ listen for requests\r\napp.listen(3000, () => {\r\n    console.log(\"Country Light App is up & the server is listening on port 3000\");\r\n});\r\n<\/pre>\n<p><b>Your application directory <code>node-countries-light-app<\/code> should look like this:<\/b><\/p>\n<pre lang=\"bash\">\r\nnode-countries-light-app\/\r\n|-- _node_modules\/\r\n    |-- ...    \r\n|-- package.json\r\n|-- package-lock.json\r\n|-- server.js\r\n<\/pre>\n<p><b>So far, you can launch the Node application with the following command. It should work! The application is available at http:\/\/localhost:3000<\/b><\/p>\n<pre lang=\"bash\">\r\n$ node server.js\r\n<\/pre>\n<p><b>The first version of the app is running on http:\/\/localhost:3000<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/006_node_api_testing_node_server.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>At http:\/\/localhost:3000, you get the welcome message<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/007_node_api_testing_node_server_localhost.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><H4>3. SOPHISTICATING THE APP<\/H4><\/p>\n<p><b>Create the config file for the database of your Node application<\/b><\/p>\n<pre lang=\"bash\">\r\n$ mkdir config\r\n$ cd config\r\n$ touch database.config.js\r\n<\/pre>\n<pre lang=\"javascript\">\r\n\/* database.config.js *\/\r\n\r\nmodule.exports = {\r\n    url: 'mongodb:\/\/localhost:27017\/countries_light_app'\r\n}\r\n<\/pre>\n<p><b>Launching <code>mongod<\/code>, mongod is the &#8220;Mongo Daemon&#8221;<\/code><\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/009_node_api_testing_node_mongod.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Launching <code>mongo<\/code> and creating the database <code>countries_light_app<\/code>, mongo is the command-line shell.<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/008_node_api_testing_node_mongo.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Your application directory <code>node-countries-light-app<\/code> should look like this:<\/b><\/p>\n<pre lang=\"bash\">\r\nnode-countries-light-app\/\r\n|-- _config\/\r\n    |-- database.config.js  \r\n|-- _node_modules\/\r\n    |-- ...    \r\n|-- package.json\r\n|-- package-lock.json\r\n|-- server.js\r\n<\/pre>\n<p><b>Create the structure for the application.<\/b><\/p>\n<pre lang=\"bash\">\r\n$ mkdir -p app\/models\r\n$ cd app\/models\r\n$ touch countrie.model.js\r\n\r\n$ mkdir app\/routes\r\n$ cd app\/routes\r\n$ touch countrie.routes.js\r\n\r\n$ mkdir app\/controllers\r\n$ cd app\/controllers\r\n$ touch countrie.controller.js\r\n<\/pre>\n<p><b>Be sure to have the following directory in your application directory <code>node-countries-light-app<\/code><\/b><\/p>\n<pre lang=\"bash\">\r\nnode-countries-light-app\/\r\n|-- _app\r\n    |-- _controllers\/\r\n        |-- countrie.controller.js\r\n    |-- _models\/\r\n        |-- countrie.model.js\r\n    |-- _routes\/\r\n        |-- countrie.routes.js\r\n|-- _config\r\n    |-- database.config.js\r\n|-- _node_modules\/\r\n    |-- ...\r\n|-- package.json\r\n|-- package-lock.json\r\n|-- server.js\r\n<\/pre>\n<p><H4>4. CREATE THE DB<\/H4><\/p>\n<p><b>In a first window of the terminal, launch the daemon of Mongo<\/b><\/p>\n<pre lang=\"bash\">$ mongod<\/pre>\n<p><b>Get into the Mongo shell<\/b><\/p>\n<pre lang=\"bash\">$ mongo<\/pre>\n<p><b>Print a list of all databases on the server<\/b><\/p>\n<pre lang=\"bash\">$ show dbs;<\/pre>\n<p><b>Use the database, just by typing this command it will create the required database<\/b><\/p>\n<pre lang=\"bash\">$ use countries_light_app;<\/pre>\n<p>Source : <a href=\"https:\/\/docs.mongodb.com\/manual\/reference\/mongo-shell\/\" target=\"_blank\">https:\/\/docs.mongodb.com\/manual\/reference\/mongo-shell\/<\/a><\/p>\n<p><H4>5. USING POSTMAN<\/H4><br \/>\nIn postman, I have a set of queries to request this new API, leveraging on the Postman&#8217;s ability to manage environment and also to store the queries so I do not have to redo the queries again and again.<\/p>\n<p><H4>5.1 USING A POSTMAN&#8217;S FILE ENVIRONMENT <\/H4><br \/>\n<b>The name for file environment that is imported in Postman under the name ENV_NODE_COUNTRIES_LIGHT_APP. The file is named <code>env_node_countries_light_app.postman_environment.json<\/code> and it contains the 2 variables {{api_root_url}} and {{api_root_url_countries}}<\/b><\/p>\n<pre lang=\"json\">\r\n{\r\n  \"id\": \"a23b2611-4076-4ea2-9ad8-9b79bccbe316\",\r\n  \"name\": \"ENV_NODE_COUNTRIES_LIGHT_APP\",\r\n  \"values\": [\r\n    {\r\n      \"key\": \"api_root_url\",\r\n      \"value\": \"http:\/\/localhost:3000\",\r\n      \"enabled\": true,\r\n      \"type\": \"text\"\r\n    },\r\n    {\r\n      \"key\": \"api_root_url_countries\",\r\n      \"value\": \"http:\/\/localhost:3000\/countries\",\r\n      \"enabled\": true,\r\n      \"type\": \"text\"\r\n    }\r\n  ],\r\n  \"_postman_variable_scope\": \"environment\",\r\n  \"_postman_exported_at\": \"2018-05-22T13:48:34.707Z\",\r\n  \"_postman_exported_using\": \"Postman\/6.0.10\"\r\n}\r\n<\/pre>\n<p><H4>5.2 USING A POSTMAN&#8217;S FILE COLLECTION<\/H4><\/p>\n<p>I also export all the queries into a postman&#8217;s collection in Postman<br \/>\nin the file <code>node_countries_light_app.postman_collection.json<\/code>. There are 6 queries for CRUD operations. <\/p>\n<ul>\n<li><b>The first query: 1_welcome_api<\/b><br \/>\nDescription: It outputs the welcome message.<br \/>\nMethod: using GET at http:\/\/localhost:3000\n<\/li>\n<li><b>The second query: 2_post_country_api<\/b><br \/>\nDescription: It enables to post a country in the database<br \/>\nMethod: using POST at http:\/\/localhost:3000\/countries<\/p>\n<p><b>Caution : Here some records to send via Postman to not have an empty database before you try to load this page.<\/b><\/p>\n<pre lang=\"json\">\r\n{ \"name\":\"Afghanistan\", \"tld\":\".af\", \"cca2\":\"AF\", \"capital\":\"Kabul\", \"callingCode\":\"93\" }\r\n{ \"name\":\"Italy\", \"tld\":\".it\", \"cca2\":\"IT\", \"capital\":\"Rome\", \"callingCode\":\"39\" }\r\n{ \"name\":\"France\", \"tld\":\".fr\", \"cca2\":\"FR\", \"capital\":\"Paris\", \"callingCode\":\"33\" }\r\n{ \"name\":\"Malaysia\", \"tld\":\".my\", \"cca2\":\"MY\", \"capital\":\"Kuala Lumpur\", \"callingCode\":\"60\" }\r\n{ \"name\":\"Mauritania\", \"tld\":\".mr\", \"cca2\":\"MR\", \"capital\":\"Nouakchott\", \"callingCode\":\"222\" }\r\n{ \"name\":\"Tunisia\", \"tld\":\".tn\", \"cca2\":\"TN\", \"capital\":\"Tunis\", \"callingCode\":\"216\" }\r\n{ \"name\":\"Tanzania\", \"tld\":\".tz\", \"cca2\":\"TZ\", \"capital\":\"Dodoma\", \"callingCode\":\"255\" }\r\n{ \"name\":\"Seychelles\", \"tld\":\".sc\", \"cca2\":\"SC\", \"capital\":\"Victoria\", \"callingCode\":\"248\" }\r\n{ \"name\":\"Norway\", \"tld\":\".no\", \"cca2\":\"NO\", \"capital\":\"Oslo\", \"callingCode\":\"47\" }\r\n{ \"name\":\"Nepal\", \"tld\":\".np\", \"cca2\":\"NP\", \"capital\":\"Kathmandu\", \"callingCode\":\"977\" }\r\n<\/pre>\n<\/li>\n<li><b>The third query: 3_get_all_countries_api<\/b><br \/>\nDescription: List all the countries<br \/>\nMethod: using GET \/countries\n<\/li>\n<li><b>The fourth query: 4_get_single_country_id_api<\/b><br \/>\nDescription: Retrieving a single Country eg 5afd8c9cad99cd0a44dfc3aa<br \/>\nMethod: using GET \/countries\/:countryId<br \/>\nCaution: The id is random so be sure to use the proper id created for each country by the insertion in the database.<\/p>\n<\/li>\n<li><b>The fifth query: 5_put_update_single_country_id_api<\/b><br \/>\nDescription: Updating a Country eg 5afd8c9cad99cd0a44dfc3aa<br \/>\nMethod: using PUT \/countries\/:countryId<br \/>\nCaution: The id is random so be sure to use the proper id created for each country by the insertion in the database.<\/p>\n<p><b>Update with the data in Italian and not in English<\/b><\/p>\n<pre lang=\"json\">\r\n{ \"name\":\"Italia\", \"tld\":\".it\", \"cca2\":\"IT\", \"capital\":\"Roma\", \"callingCode\":\"39\" }\r\n<\/pre>\n<p><b>Bring back in English if needed<\/b><\/p>\n<pre lang=\"json\">\r\n{ \"name\":\"Italy\", \"tld\":\".it\", \"cca2\":\"IT\", \"capital\":\"Rome\", \"callingCode\":\"39\" }\r\n<\/pre>\n<\/li>\n<li><b>The sixth query: 6_delete_single_country_id_api<\/b><br \/>\nDescription: Deleting a Country using the countryId<br \/>\nMethod: using DELETE \/countries\/:countryId<br \/>\nCaution: The id is random so be sure to use the proper id created for each country by the insertion in the database.<\/p>\n<\/li>\n<\/ul>\n<p><b>Restart the application with the database with <code>$ node server.js<\/code><\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/012_node_api_testing_node_server_with_db.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Post few countries in the database with Postman<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/011_node_api_testing_node_postman_post_country.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Check the url http:\/\/localhost:3000\/countries, you should get the list of all the countries inserted in the database.<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/010_node_api_testing_node_localhost.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><H4>6. THE DOCUMENTATION USING APIDOC<\/h4>\n<p>Fine, you have an API but believe me it is useless without documentation because nobody will get their hands dirty with your API if it is not documented. Here is a nice easy way to create documentation with the help of the comments inside the code.<\/p>\n<p><b>To start our documentation process, first you need to create a descriptor file called <code>apidoc.json<\/code> inside your app directory.<\/b><\/p>\n<pre lang=\"bash\">\r\n$ cd \/[path-in-your-environment]\/node-countries-light-app\/\r\n$ touch apidoc.json\r\n<\/pre>\n<p><b><code>apidoc.json<\/code> required theses attributes. You can add this content for instance in the file <code>apidoc.json<\/code><\/b><\/p>\n<pre lang=\"json\">\r\n{\r\n    \"name\": \"Yallah Yallah, Welcome to Country Light App\",\r\n    \"version\": \"1.0.1\",\r\n    \"description\": \"Country Light App, a prototype to play with Countries\",\r\n    \"template\": {\r\n        \"forceLanguage\": \"en\"\r\n    }\r\n}\r\n<\/pre>\n<p><b>Create the directory for the documentation (\/public\/apidoc) inside your app directory<\/b><\/p>\n<pre lang=\"bash\">\r\n$ mkdir public\r\n$ cd public\r\n$ mkdir apidoc\r\n<\/pre>\n<p><b>Add this line to your file server.js<\/b><\/p>\n<pre lang=\"javascript\">\r\n\/\/ Serving static files from \"public\" folder.\r\n\/\/ Will be useful for apidoc\r\napp.use(express.static('public'))\r\n<\/pre>\n<p><b>Be sure to have the following directory in your application directory <code>node-countries-light-app<\/code><\/b><\/p>\n<pre lang=\"bash\">\r\nnode-countries-light-app\/\r\n|-- _app\r\n    |-- _controllers\r\n        |-- countrie.controller.js\r\n    |-- _models\r\n        |-- countrie.model.js\r\n    |-- _routes\r\n        |-- countrie.routes.js\r\n|-- _config\r\n    |-- database.config.js\r\n|-- _node_modules\r\n    |-- ...  \r\n|-- _public\r\n    |-- apidoc\r\n        |-- ...\r\n|-- apidoc.json\r\n|-- package.json\r\n|-- package-lock.json\r\n|-- server.js\r\n<\/pre>\n<p><b>Apidoc by default is reading the comment that are written in the route file for instance. In my case, it will be <code>country.routes.js<\/code>. You have to type some comments params provided by apidoc. You can do such operation for each route you want to document<\/b><\/p>\n<pre lang=\"javascript\">\r\n\/\/ Create a new Country\r\n\r\n\/**\r\n    * @api {post} \/countries Register a new country\r\n    * @apiGroup Countries\r\n    * @apiParam {String} countries.name Country name\r\n    * @apiParam {String} countries.tld Country tld\r\n    * @apiParam {String} countries.cca2 Country cca2\r\n    * @apiParam {String} countries.capital Country capital\r\n    * @apiParam {Number} countries.callingCode Country callingCode\r\n    * @apiParamExample {json} Input\r\n    *    {\r\n    *   \"name\": \"Tunisia\",\r\n    *   \"tld\": \".tn\",\r\n    *   \"cca2\": \"TN\",\r\n    *   \"capital\": \"Tunis\",\r\n    *   \"callingCode\": \"216\"\r\n    * }\r\n    * @apiSuccess {Number} countries.id Country id\r\n    * @apiSuccess {String} countries.name Country name\r\n    * @apiSuccess {String} countries.tld Country tld\r\n    * @apiSuccess {String} countries.cca2 Country cca2\r\n    * @apiSuccess {String} countries.capital Country capital\r\n    * @apiSuccess {Number} countries.callingCode Country callingCode\r\n    * @apiSuccess {Date} countries.createdAt Update's date\r\n    * @apiSuccess {Date} countries.updatedAt Register's date\r\n    * @apiSuccessExample {json} Success\r\n    *    HTTP\/1.1 200 OK\r\n    *    {\r\n    *   \"_id\": \"5b041ac6e3333f03fee37042\",\r\n    *   \"name\": \"Tunisia\",\r\n    *   \"capital\": \"Tunis\",\r\n    *   \"tld\": \".tn\",\r\n    *   \"cca2\": \"TN\",\r\n    *   \"callingCode\": 216,\r\n    *   \"createdAt\": \"2018-05-22T13:27:34.919Z\",\r\n    *   \"updatedAt\": \"2018-05-22T13:27:34.919Z\",\r\n    *   \"__v\": 0\r\n    * }\r\n    * @apiErrorExample {json} Register error\r\n    *    HTTP\/1.1 500 Internal Server Error\r\n *\/\r\n<\/pre>\n<p>Source : <a href=\"http:\/\/apidocjs.com\/#params\" target=\"_blank\">http:\/\/apidocjs.com\/#params<br \/>\n<\/a><\/p>\n<p><b>Install and generate the documentation using apidoc<\/b><\/p>\n<pre lang=\"bash\">\r\n$ npm install apidoc --save\r\n$ apidoc -e \"(node_modules|public)\" -o public\/apidoc\r\n<\/pre>\n<p><b>The content created by apidoc will be in the output directory <code>public\/apidoc<\/code> and it will be available at http:\/\/localhost:3000\/apidoc<\/b><\/p>\n<p><b>Generate the documentation<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/014_node_api_testing_node_postman_export_apidoc.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Browse your brand new documentation<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/015_node_api_testing_node_postman_export_apidoc.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>All the routes have been documented<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/016_node_api_testing_node_postman_export_apidoc.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><H4>7. RUNNING THE TESTS<\/H4><\/p>\n<p><b>Create the directory the test directory inside your application<\/b><\/p>\n<pre lang=\"bash\">\r\n$ mkdir test\r\n$ touch test\/test_the_api.js\r\n<\/pre>\n<pre lang=\"bash\">\r\nnode-countries-light-app\/\r\n|-- _app\r\n    |-- _controllers\r\n        |-- countrie.controller.js\r\n    |-- _models\r\n        |-- countrie.model.js\r\n    |-- _routes\r\n        |-- countrie.routes.js\r\n|-- _config\r\n    |-- database.config.js\r\n|-- _node_modules\r\n    |-- ... \r\n|-- _public\r\n    |-- apidoc\r\n        |-- ... \r\n|-- test\r\n    |-- test_the_api.js\r\n|-- apidoc.json\r\n|-- package.json\r\n|-- package-lock.json\r\n|-- server.js\r\n<\/pre>\n<p><b>Install Mocha, Chai and SuperTest with npm<\/b><\/p>\n<pre lang=\"bash\">\r\n$ npm install mocha chai supertest --save\r\n<\/pre>\n<p><b>Do not forget to add this line to your file package.json to enable the test<\/b><\/p>\n<pre lang=\"json\">\"scripts\": {\r\n    \"test\": \"mocha test\/*.js --timeout 15000\"\r\n  },\r\n<\/pre>\n<p><b>Launch the tests. It will read all the .js file inside the test directory.<\/b><\/p>\n<pre lang=\"bash\">$ npm test<\/pre>\n<p>Intentionally, I have made an error in the first test to be sure that is currently testing the welcome message. Just in case.<\/p>\n<pre lang=\"javascript\">\r\nexpect(res.body.message).to.equal(\"Hello, hello, Yallah, Welcome to Country Light App. A prototype to play with Countries\");\r\n<\/pre>\n<pre lang=\"javascript\">\r\nexpect(res.body.message).to.equal(\"Yallah, Welcome to Country Light App. A prototype to play with Countries\");\r\n<\/pre>\n<p><b>Installing mocha, chai and supertest<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/017_node_api_testing_node_test.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Running the test with <code>$ npm test<\/code><\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/018_node_api_testing_node_running.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><b>Running the test with <code>$ npm test<\/code> with an intentional error just to be sure it is working.<\/b><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/019_node_api_testing_node_running_failed.jpg\" width=\"640\" height=\"480\" alt=\"Node, API, Postman - Buid a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc\"><\/p>\n<p><H4>8. AN EXTRA LINE AND THE CONCLUSION<\/H4><\/p>\n<p><b>To use the command <code>npm start<\/code>, you can add this line to your file package.json<\/b><\/p>\n<pre lang=\"json\">\r\n  \"scripts\": {\r\n    \"start\": \"node server.js\",\r\n    \"test\": \"mocha test\/*.js --timeout 15000\"\r\n  },\r\n<\/pre>\n<p><b>I believe, it is a true A to Z manual of creation for a Node API. I try to shrink as much as possible the technical explanations and give the logic of a true step by step so anyone can decide to build a full documented API-POC with Node.<\/b><\/p>\n<p><b>If you download the application from github, just launch the installation with the help of file package.json with the following command.<\/b><\/p>\n<pre lang=\"bash\">$ npm install<\/pre>\n<pre lang=\"bash\">\r\n$ git clone https:\/\/github.com\/bflaven\/node-countries-light-app.git\r\n$ cd node-countries-light-app\r\n$ npm install\r\n<\/pre>\n<p><b>After this, you can jump directly to the point 4. CREATE THE DB<\/b><\/p>\n<h2>Read more<\/h2>\n<ul>\n<h4>Tutorials<\/h4>\n<li>Excellent article. Very inspiring. Building a Restful CRUD API with Node.js, Express and MongoDB<br \/><a href=\"https:\/\/www.callicoder.com\/node-js-express-mongodb-restful-crud-api-tutorial\/\" target=\"_blank\">https:\/\/www.callicoder.com\/node-js-express-mongodb-restful-crud-api-tutorial\/<\/a><\/li>\n<li>Documenting APIs using ApiDoc.js by Caio Ribeiro Pereira<br \/><a href=\"https:\/\/blog.jscrambler.com\/documenting-apis-using-apidoc-js\/\" target=\"_blank\">https:\/\/blog.jscrambler.com\/documenting-apis-using-apidoc-js\/<\/a><\/li>\n<li>Build Node.js RESTful APIs in 10 Minutes<br \/><a href=\"https:\/\/www.codementor.io\/olatundegaruba\/nodejs-restful-apis-in-10-minutes-q0sgsfhbd\" target=\"_blank\">https:\/\/www.codementor.io\/olatundegaruba\/nodejs-restful-apis-in-10-minutes-q0sgsfhbd<\/a><\/li>\n<li>Git repository for Nodejs in 10 minutes<br \/><a href=\"https:\/\/github.com\/generalgmt\/RESTfulAPITutorial\" target=\"_blank\">https:\/\/github.com\/generalgmt\/RESTfulAPITutorial<\/a><\/li>\n<li>How to Use json-server to Create Mock APIs<br \/><a href=\"https:\/\/www.codementor.io\/ayushgupta\/how-to-use-json-server-to-create-mock-apis-0-lci958ear\" target=\"_blank\">https:\/\/www.codementor.io\/ayushgupta\/how-to-use-json-server-to-create-mock-apis-0-lci958ear<\/a><\/li>\n<li>Create A REST API With JSON Server<br \/><a href=\"https:\/\/medium.com\/codingthesmartway-com-blog\/create-a-rest-api-with-json-server-36da8680136d\" target=\"_blank\">https:\/\/medium.com\/codingthesmartway-com-blog\/create-a-rest-api-with-json-server-36da8680136d<\/a><\/li>\n<li>Build a Node.js API in Under 30 Minutes<br \/><a href=\"https:\/\/medium.freecodecamp.org\/building-a-simple-node-js-api-in-under-30-minutes-a07ea9e390d2\" target=\"_blank\">https:\/\/medium.freecodecamp.org\/building-a-simple-node-js-api-in-under-30-minutes-a07ea9e390d2<\/a><\/li>\n<li>Very good article in Spanish. Testeo de API REST con Mocha y Chai-HTTP<br \/><a href=\"https:\/\/www.paradigmadigital.com\/dev\/testeo-api-rest-mocha-chai-http\/\" target=\"_blank\">https:\/\/www.paradigmadigital.com\/dev\/testeo-api-rest-mocha-chai-http\/<\/a><\/li>\n<li>Very good article in Spanish. Testeando JavaScript con Mocha y Chai<br \/><a href=\"https:\/\/www.paradigmadigital.com\/dev\/testeando-javascript-mocha-chai\/\" target=\"_blank\">https:\/\/www.paradigmadigital.com\/dev\/testeando-javascript-mocha-chai\/<\/a><\/li>\n<li>Git repository for Testeo de API REST con Mocha y Chai HTTP.<br \/><a href=\"https:\/\/github.com\/paradigmadigital\/ChaiHttp-sample\" target=\"_blank\">https:\/\/github.com\/paradigmadigital\/ChaiHttp-sample<\/a><\/li>\n<h4>Books and Code<\/h4>\n<li>Excellent Book in Brazilian: Construindo APIs REST com Node.js<br \/><a href=\"https:\/\/www.casadocodigo.com.br\/products\/livro-apis-nodejs\" target=\"_blank\">https:\/\/www.casadocodigo.com.br\/products\/livro-apis-nodejs<\/a><\/li>\n<li>The same in English: Building APIs with Node.js<br \/><a href=\"https:\/\/leanpub.com\/building-apis-with-nodejs\" target=\"_blank\">https:\/\/leanpub.com\/building-apis-with-nodejs<\/a><\/li>\n<li>Git repository for Construindo APIs REST com Node.js by Caio Ribeiro Pereira<br \/><a href=\"https:\/\/github.com\/caio-ribeiro-pereira\/building-apis-with-nodejs\" target=\"_blank\">https:\/\/github.com\/caio-ribeiro-pereira\/building-apis-with-nodejs<\/a><\/li>\n<li>Git repository of Caio Ribeiro Pereira, the author<br \/><a href=\"https:\/\/github.com\/caio-ribeiro-pereira\" target=\"_blank\">https:\/\/github.com\/caio-ribeiro-pereira<\/a><\/li>\n<li>Professional Node.js: Building Javascript Based Scalable Software<br \/><a href=\"http:\/\/www.wrox.com\/WileyCDA\/WroxTitle\/Professional-Node-js-Building-Javascript-Based-Scalable-Software.productCd-1118185463.html\" target=\"_blank\">http:\/\/www.wrox.com\/WileyCDA\/WroxTitle\/Professional-Node-js-Building-Javascript-Based-Scalable-Software.productCd-1118185463.html<\/a><\/li>\n<h4>Other resources<\/h4>\n<li>Introduction to Node.js API Unit Testing with Mocha and Chai<br \/><a href=\"https:\/\/ubuverse.com\/introduction-to-node-js-api-unit-testing-with-mocha-and-chai\/\" target=\"_blank\">https:\/\/ubuverse.com\/introduction-to-node-js-api-unit-testing-with-mocha-and-chai\/<\/a><\/li>\n<li>Testing APIs with Mocha<br \/><a href=\"https:\/\/blog.jscrambler.com\/testing-apis-mocha-2\/\" target=\"_blank\">https:\/\/blog.jscrambler.com\/testing-apis-mocha-2\/<\/a><\/li>\n<li>Make your node.js api bulletproof: how to test with mocha, chai, and supertest<br \/><a href=\"http:\/\/developmentnow.com\/2015\/02\/05\/make-your-node-js-api-bulletproof-how-to-test-with-mocha-chai-and-supertest\/\" target=\"_blank\">http:\/\/developmentnow.com\/2015\/02\/05\/make-your-node-js-api-bulletproof-how-to-test-with-mocha-chai-and-supertest\/<\/a><\/li>\n<li>Testing Node.js with Mocha and Chai<br \/>\n<br \/><a href=\"http:\/\/mherman.org\/blog\/2015\/09\/10\/testing-node-js-with-mocha-and-chai\/#.Wu1ad9OFMWo\" target=\"_blank\">http:\/\/mherman.org\/blog\/2015\/09\/10\/testing-node-js-with-mocha-and-chai\/#.Wu1ad9OFMWo<\/a><\/li>\n<li>Unit test your Nodejs RESTful API using mocha<br \/><a href=\"https:\/\/javascript.tutorialhorizon.com\/2014\/09\/14\/unit-test-your-nodejs-restful-api-using-mocha\/\" target=\"_blank\">https:\/\/javascript.tutorialhorizon.com\/2014\/09\/14\/unit-test-your-nodejs-restful-api-using-mocha\/<\/a><\/li>\n<li>Good article. BDD in JavaScript: Getting Started with Cucumber and Gherkin<br \/><a href=\"https:\/\/www.sitepoint.com\/bdd-javascript-cucumber-gherkin\/\" target=\"_blank\">https:\/\/www.sitepoint.com\/bdd-javascript-cucumber-gherkin\/<\/a><\/li>\n<li>The evolution journey of Android GUI testing. Good article (the only article where some feedback and abstraction)<br \/><a href=\"https:\/\/medium.com\/@sebaslogen\/the-evolution-journey-of-android-gui-testing-f65005f7ced8\" target=\"_blank\">https:\/\/medium.com\/@sebaslogen\/the-evolution-journey-of-android-gui-testing-f65005f7ced8<\/a><\/li>\n<li>Good article. Into the Belly of the Beast: UI Testing an Android App with Cucumber and Espresso<br \/><a href=\"https:\/\/medium.com\/@Alex_Fogleman\/into-the-belly-of-the-beast-ui-testing-an-android-app-with-cucumber-and-espresso-4a65ae61539a\n\" target=\"_blank\">https:\/\/medium.com\/@Alex_Fogleman\/into-the-belly-of-the-beast-ui-testing-an-android-app-with-cucumber-and-espresso-4a65ae61539a<br \/>\n<\/a><\/li>\n<li>CucumberEspressoDemo<br \/><a href=\"https:\/\/github.com\/emmasuzuki\/CucumberEspressoDemo\" target=\"_blank\">https:\/\/github.com\/emmasuzuki\/CucumberEspressoDemo<\/a><\/li>\n<li>Getting Started with TDD in Swift 3<br \/><a href=\"https:\/\/medium.com\/@ynzc\/getting-started-with-tdd-in-swift-2fab3e07204b\" target=\"_blank\">https:\/\/medium.com\/@ynzc\/getting-started-with-tdd-in-swift-2fab3e07204b<\/a><\/li>\n<li>End to end Gherkin testing with Cucumber.js and Protractor\u200a\u2014\u200amake your team amazing<br \/><a href=\"https:\/\/medium.com\/simdevelopers\/end-to-end-gherkin-testing-with-cucumber-js-and-protractor-make-your-team-amazing-4f3e2e1a2adc\" target=\"_blank\">https:\/\/medium.com\/simdevelopers\/end-to-end-gherkin-testing-with-cucumber-js-and-protractor-make-your-team-amazing-4f3e2e1a2adc<\/a><\/li>\n<li>Tartare: Code Driven Testing<br \/><a href=\"https:\/\/engineering.telefonica.com\/tartare-code-driven-testing-ed8b1d4df6d7\n\" target=\"_blank\">https:\/\/engineering.telefonica.com\/tartare-code-driven-testing-ed8b1d4df6d7<br \/>\n<\/a><\/li>\n<li>Getting Started with Node.js and Mocha<br \/><a href=\"https:\/\/semaphoreci.com\/community\/tutorials\/getting-started-with-node-js-and-mocha\" target=\"_blank\">https:\/\/semaphoreci.com\/community\/tutorials\/getting-started-with-node-js-and-mocha<\/a><\/li>\n<li>How to run Mocha\/Chai unit tests on Node.js apps<br \/><a href=\"https:\/\/buddy.works\/guides\/how-automate-nodejs-unit-tests-with-mocha-chai\" target=\"_blank\">https:\/\/buddy.works\/guides\/how-automate-nodejs-unit-tests-with-mocha-chai<\/a><\/li>\n<li>UI Testing with Puppeteer and Mocha\u200a\u2014\u200aPart 1 (Getting Started)<br \/><a href=\"https:\/\/medium.com\/@ankit_m\/ui-testing-with-puppeteer-and-mocha-part-1-getting-started-b141b2f9e21\" target=\"_blank\">https:\/\/medium.com\/@ankit_m\/ui-testing-with-puppeteer-and-mocha-part-1-getting-started-b141b2f9e21<\/a><\/li>\n<li>How to Build and Structure a Node.js MVC Application<br \/><a href=\"https:\/\/www.sitepoint.com\/node-js-mvc-application\/\" target=\"_blank\">https:\/\/www.sitepoint.com\/node-js-mvc-application\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>These latest months, I have made a lot of research on Testing an API. I dug deep into Mocha, Chai, Postman and Newman. I have&hellip; <\/p>\n<p class=\"text-center\"><a href=\"https:\/\/flaven.fr\/2018\/05\/node-api-postman-buid-a-simple-but-complete-rest-api-with-node-tested-with-chai-and-newman-documented-with-apidoc\/\" class=\"more-link\">Continue reading &rarr; <span class=\"screen-reader-text\">Node, API, Postman &#8211; Build a simple but complete REST API with Node, tested with Chai and Newman, documented with Apidoc<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":11141,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"bf_ai_meta_description":"Build a complete REST API with Node, test with Chai and Newman, and document with Apidoc. Ideal for non-developers to create accurate POCs.","bf_ai_og_title":"Build REST API with Node","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[3439,3437,3440,3441,3444,3447,3448,3449,3435],"tags":[2183,2427,2424,2403,226,192,3514,2423,2322,2317],"class_list":["post-11119","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apis-integration","category-business-case-studies","category-cloud-infrastructure","category-data-analytics","category-programming-databases","category-technology-trends","category-tools-productivity","category-tutorials-how-to","category-web-development","tag-api","tag-apidoc","tag-chai","tag-dump","tag-javascript","tag-json","tag-mongodb","tag-newman","tag-postman","tag-tests"],"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3Vuhl-2Tl","jetpack_featured_media_url":"https:\/\/flaven.fr\/wp-content\/uploads\/2018\/05\/node_api_testing_b.jpg","_links":{"self":[{"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/posts\/11119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/comments?post=11119"}],"version-history":[{"count":14,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/posts\/11119\/revisions"}],"predecessor-version":[{"id":11153,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/posts\/11119\/revisions\/11153"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/media\/11141"}],"wp:attachment":[{"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/media?parent=11119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/categories?post=11119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flaven.fr\/happy-api\/wp\/v2\/tags?post=11119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}