मुख्य सामग्री पर जाएं
प्रोजेक्ट टेम्पलेट·Pro

बिना डिपेंडेंसी का Node.js JSON API

node:http पर नोट्स API: बनाना, सूची, बदलना और हटाना, इनपुट जाँच और JSON एरर के साथ, डेटा एक फ़ाइल में सेव होता है। कुछ इंस्टॉल नहीं करना: server.js पर Run टैप करें, ऐप का अपना Node.js इसे localhost:3000 पर चालू कर देगा। टेस्ट भी शामिल हैं।

इसे इंस्टॉल करने के लिए PocketCode Pro चाहिए।

अगर आपके Android डिवाइस पर PocketCode इंस्टॉल है, तो यह पेज ऐप में खुलेगा।

प्रीव्यू

फ़ाइलें

README.md
package.json
server.js
src/app.js
src/store.js
test/api.test.js

README.md

# Notes API on Node.js, no dependencies A JSON API for notes built on `node:http`: create, list, read, update and delete, with input checks, clear error messages and a request log. Notes are saved to `data/notes.json` after every change. There is nothing to install: no npm packages, no framework. ## Run it in PocketCode 1. Open `server.js` and tap Run. The app's own Node.js starts it; the Run panel shows `Notes API on http://localhost:3000`. 2. Open `http://localhost:3000` in the DevBrowser (or in the phone's browser) to see the list of endpoints. 3. Try the API from the terminal, or from any HTTP client: ```sh curl -X POST localhost:3000/api/notes -H 'content-type: application/json' -d '{"text":"Buy milk"}' curl localhost:3000/api/notes ``` 4. Tap Stop in the Run panel to end it. You don't need the Linux environment to run the server. `curl` and `npm` are in the terminal's Linux environment with Node.js. ## Run the tests - Open `test/api.test.js` and tap Run. - Or, in the terminal: `npm test`. The tests start the server on a free port with the notes in memory, so they never touch `data/notes.json`. ## Endpoints | Method and path | Body | Answer | |---|---|---| | `GET /health` | | `{"ok": true}` | | `GET /api/notes` | | All notes, oldest first | | `POST /api/notes` | `{"text": "..."}` | 201 and the new note | | `GET /api/notes/:id` | | The note, or 404 | | `PATCH /api/notes/:id` | `{"text"?: "...", "done"?: true}` | The updated note |

यह प्रीव्यू छोटा किया गया है। पूरा कंटेंट इंस्टॉल करने पर मिलेगा।

1.0.0 में बदलाव

पहला संस्करण।

संबंधित

Express + SQLite टास्क APIProप्रोजेक्ट टेम्पलेटExpress 5 पर टास्क API, जिसमें फ़िल्टर, पेजिंग और टेस्ट हैं। डेटा node:sqlite में जाता है, इसलिए कुछ भी नेटिव कंपाइल नहीं करना पड़ता। Node.js 22.13 या नए वाला Linux एनवायरनमेंट चाहिए; npm install लगभग 3.5 MB डाउनलोड करता है।सादे JavaScript में टू-डू लिस्टProप्रोजेक्ट टेम्पलेटसादे JavaScript मॉड्यूल से बनी टू-डू लिस्ट: जोड़ें, वहीं संपादित करें, टिक करें, फ़िल्टर करें और पूरे हुए हटाएँ; सूची localStorage में सेव रहती है। लॉजिक के लिए Node के टेस्ट रनर वाले टेस्ट हैं। DevBrowser और ऐप के अपने Node.js में चलती है, Linux की ज़रूरत नहीं।Markdown स्टैटिक साइटProप्रोजेक्ट टेम्पलेटपेज Markdown में लिखें और उन्हें एक ही लेआउट और मेन्यू वाली स्टैटिक HTML साइट में बदलें। बिल्ड लगभग 110 लाइन का Node.js है जिसे आप बदल सकते हैं, और अकेला पैकेज marked है। नतीजा DevBrowser में खोलें। पहले npm install के लिए Linux एनवायरनमेंट चाहिए।Rust CLI: लाइन काउंटरProप्रोजेक्ट टेम्पलेटRust में कमांड-लाइन टूल जो किसी फ़ोल्डर में भाषा के हिसाब से कोड, कमेंट और खाली लाइनें गिनता है। यह बिना डिपेंडेंसी का Cargo प्रोजेक्ट है, यूनिट टेस्ट के साथ। Linux एनवायरनमेंट में Rust और Cargo चाहिए (लगभग 370 MB)।FastAPI लिंक शॉर्टनरProप्रोजेक्ट टेम्पलेटPython, FastAPI और SQLite में लिंक शॉर्टनर। यह छोटे कोड बनाता है, रीडायरेक्ट करता है और क्लिक गिनता है; साथ में एक पेज का फ़ॉर्म और pytest टेस्ट हैं। Linux एनवायरनमेंट में pip के साथ Python 3.10 या नया चाहिए; यह तय वर्शन वाले 14 पैकेज इंस्टॉल करता है।Next.js + Tailwind + i18nProप्रोजेक्ट टेम्पलेटnext-intl और Tailwind CSS वाला Next.js 15 प्रोजेक्ट, जिसमें /en और /es पर अंग्रेज़ी और स्पेनिश में एक पेज है। डार्क मोड सिस्टम के अनुसार चलता है। Node.js के साथ Linux एनवायरनमेंट चाहिए; पहला npm install लगभग 400 MB डाउनलोड करता है।