code-snippet-organizer

1.0.3 • Public • Published

Code Snippet Organizer API

Build Status Coverage Status NPM version NPM downloads MIT License

Installation

npm install code-snippet-organizer --save

API

Table of Contents

  • [createServer]
  • [POST /api/snippets]
  • [GET /api/snippets]
  • [GET /api/snippets/:id]
  • [PUT /api/snippets/:id]
  • [DELETE /api/snippets/:id]

createServer

Create and configure the server to manage code snippets.

Example Usage

const snippetOrganizer = require('code-snippet-organizer');
const app = snippetOrganizer();
const PORT = process.env.PORT || 5000;

app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});

POST /api/snippets

Create a new code snippet.

Parameters

title (String): The title of the snippet.
code (String): The code content of the snippet.
language (String): The programming language of the snippet.
tags (Array): List of tags associated with the snippet.

Example Request Body

{
  "title": "REST API Example",
  "code": "console.log(\"Implementing RESTful API with Node.js\");",
  "language": "JavaScript",
  "tags": ["REST", "API", "example"]
}

GET /api/snippets

Retrieve all code snippets.

GET /api/snippets/:id

Retrieve a specific code snippet by ID.

PUT /api/snippets/:id

Update a specific code snippet by ID.

Example Request Body

{
  "title": "Updated Snippet",
  "code": "console.log(\"Updated code snippet\");",
  "language": "JavaScript",
  "tags": ["updated", "snippet"]
}

DELETE /api/snippets/

Delete a specific code snippet by ID.

Package Sidebar

Install

npm i code-snippet-organizer

Weekly Downloads

5

Version

1.0.3

License

ISC

Unpacked Size

19.9 kB

Total Files

5

Last publish

Collaborators

  • charishma_bollineni