Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A very simple API prototype file based database

License

NotificationsYou must be signed in to change notification settings

hidaytrahman/preapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Based Databse REST API

A very simple prototype file based database REST API developed usingNodejs,ExpressJS, its easy to use to any type of project

Usecases

  • Dont wait for BE you can use till BE is ready
  • Learn CRUD operations without having API dependencies
  • No real database required
  • Build Prototype based apps and more

Docs

How to use?

  1. Download orfork it
  2. runnpm install
  3. npm start

Thats it.

It can be accessible here :http://localhost:3030/todos

* Feel free to change port

Feel free to useVSCode REST Client extension docs are already available indocs/API.rest file


Get Todos (anything)

GET: http://localhost:3030/todos
{"todos": [    {"id":"eBPNbH6TOc40qu6DWcRv","todo":"Visit office space","isCompleted":true,"created_at":"2022-12-07T19:10:39.106Z"    }  ],"message":"Todo fetched successfully!"}

Create

POSThttp://localhost:3030/todoContent-Type:{{contentType}}{"todo":"New todo item","isCompleted":true}

Response

{"todos": [    {"id":"eBPNbH6TOc40qu6DWcRv","todo":"New todo item","isCompleted":true,"created_at":"2022-12-07T19:10:39.106Z"    }  ],"message":"Todo fetched successfully!"}

Delete

DELETEhttp://localhost:3030/todo/{id}Content-Type:{{contentType}}

Response (OK)

{"message":"Deleted Successfully!"}

Response (Not exist)

{"message":"Data doesn't exist or please check the id"}

File Database

All database files should be undersrc/data/ folder

Example database for Todosrc/data/data.json


[8]ページ先頭

©2009-2025 Movatter.jp