Skip to content

Uso de Json-server para crear un endpoint para simular una API REST

Notifications You must be signed in to change notification settings

oscarvalenzuela25/Back-JSON-server-fake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Pasos para levantar JSON Server

Instalar dependencia global

npm install -g json-server

Ahora creamos un archivo db.json, por ejemplo

{
  "posts": [
    { "id": 1, "title": "json-server", "author": "typicode" }
  ],
  "comments": [
    { "id": 1, "body": "some comment", "postId": 1 }
  ],
  "profile": { "name": "typicode" }
}

Levantamos nuestro server

json-server --watch db.json

Listo

Si vas al endpoint http://localhost:3000/posts/1 deberia de salirte

{ "id": 1, "title": "json-server", "author": "typicode" }

Documentación

Link a Documentación

About

Uso de Json-server para crear un endpoint para simular una API REST

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published