Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/oscarvalenzuela25/back-json-server-fake

Uso de Json-server para crear un endpoint para simular una API REST
https://github.com/oscarvalenzuela25/back-json-server-fake

json-server-fake project

Last synced: 12 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# 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](https://github.com/typicode/json-server)