Get Started in Minutes
Learn how to install and configure node-api-document for your Node.js project with our comprehensive step-by-step guide.
System Requirements
Make sure your system meets these requirements before getting started.
Node.js
18.0.0 or higherNPM
9.0.0 or higherFramework
Express.jsBrowser
Modern browsersInstallation
Choose your preferred package manager to install node-api-document.
npm install node-api-document
Quick Start Guide
Get up and running with a basic configuration in under 5 minutes.
1
Setup Express App
Create a basic Express.js application and import the package.
const express = require('express');
const createDoc = require('node-api-document');
const app = express();
const PORT = process.env.PORT || 3000;
2
Define API Structure
Create your API documentation structure with endpoints and metadata.
const apiDoc = [
{
new_tag: "1",
color: "black",
title: "COMMON API",
icon: "list"
},
{
new_tag: "0",
color: "orange",
icon: "flag",
title: "1 : COMMON",
name: "Get Country List",
meth: "GET",
link: "http://localhost:3000/country_list",
mandatory: "",
optional: "",
is_header: "YES",
is_push: "NO",
header: "API-KEY",
notes: "This API is used to get the country list",
example: "",
status: "1. HTTP_OK [200] - status : success\n2. HTTP_OK [201] - status : error\n3. HTTP_NOT_FOUND [204]",
imp: ""
}
];
3
Generate Documentation
Initialize the documentation and start your server.
createDoc(app, 'token, api-key', apiDoc);
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});
Complete Example
Here's a complete working example that you can copy and use immediately.
const express = require('express');
const createDoc = require('node-api-document');
const app = express();
const PORT = process.env.PORT || 3000;
// Middleware
app.use(express.json());
// API Documentation Structure
const apiDoc = [
{
new_tag: "1",
color: "black",
title: "AUTH API",
icon: "person"
},
{
new_tag: "0",
color: "green",
icon: "person",
title: "1 : AUTH",
name: "SIGN UP",
meth: "POST",
link: "http://localhost:3000/auth/signup",
mandatory: "name, email, password, termsAndPrivacy(true/false)",
optional: "",
is_header: "YES",
is_push: "NO",
header: "API-KEY",
notes: "This API is used to user Sign Up",
example: "",
status: "1. HTTP_OK [200] - status : success\n2. HTTP_OK [201] - status : error",
imp: ""
},
{
new_tag: "0",
color: "green",
icon: "person",
title: "2 : AUTH",
name: "LOGIN",
meth: "POST",
link: "http://localhost:3000/auth/login",
mandatory: "email, password",
optional: "",
is_header: "YES",
is_push: "NO",
header: "API-KEY",
notes: "This API is used to login",
example: "",
status: "1. HTTP_OK [200] - status : success\n2. HTTP_OK [201] - status : error\n3. HTTP_OK [201] - status : verify\n4. HTTP_OK [200] - status : complete",
imp: ""
}
];
// Initialize API Documentation
createDoc(app, 'token, api-key', apiDoc);
// Start server
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
console.log(`API Documentation available at: http://localhost:${PORT}/api-docs`);
});
Pro Tip: Your API documentation will be automatically available at
/api-docs
endpoint once you start your server.Success: The documentation includes interactive testing, request/response examples, and beautiful UI that works on all devices.
Important: Make sure to define all your API endpoints in the
apiDoc
array for complete documentation coverage.Customization: You can customize colors, icons, and styling to match your brand. Learn more in our API Reference.
What's Next?
Now that you have node-api-document installed, explore these resources to get the most out of it: