https://github.com/fredericbonnet/instakittens-json-server
Mock REST API server for the Instakittens project
https://github.com/fredericbonnet/instakittens-json-server
Last synced: about 1 year ago
JSON representation
Mock REST API server for the Instakittens project
- Host: GitHub
- URL: https://github.com/fredericbonnet/instakittens-json-server
- Owner: fredericbonnet
- Created: 2018-11-15T21:50:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:38:57.000Z (over 3 years ago)
- Last Synced: 2025-06-04T16:06:19.047Z (about 1 year ago)
- Language: JavaScript
- Size: 2.55 MB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Instakittens JSON Server
This project implements a simple mock REST API server for the [Instakittens
project](https://github.com/fredericbonnet/instakittens).
It is based on the awesome [JSON
Server](https://github.com/typicode/json-server) package that lets you build a
fully working REST API server from a simple JSON file.
## JSON Database
The [mock database file](db.json) was generated by the companion app
[Instakittens Data
Generator](https://github.com/fredericbonnet/instakittens-data-generator).
## REST API server
Powered by [JSON Server](https://github.com/typicode/json-server).
## Tests
- Test frameworks: [Mocha](https://mochajs.org/),
[Cucumber-js](https://github.com/cucumber/cucumber-js), [Cypress](https://www.cypress.io/)
- Assertion library: [Chai](https://www.chaijs.com/)
- E2E testing: [Supertest](https://github.com/visionmedia/supertest)
- Mocking: [Sinon](https://sinonjs.org/), [Sinon-Chai](https://github.com/domenic/sinon-chai), [node-mocks-http](https://github.com/howardabrams/node-mocks-http), [mock-require](https://github.com/boblauer/mock-require)
## NPM Scripts
### Serving the app
Start the development server on port 3000 with persistent data in `db.json`:
```sh
npm run start
```
Start the development server on port 3000 with non-persistent, fresh data from `db.json`:
```sh
npm run start:fresh
```
Start the development server on port 3000 in watch and fresh mode:
```sh
npm run watch
```
### Unit tests
Run unit tests once:
```sh
npm run test
```
Run unit tests in watch mode:
```sh
npm run test:watch
```
### End-to-end tests
End-to-end tests will spawn their own server instance on a random port.
### Supertest
Run Supertest tests once:
```sh
npm run e2e
```
Run Supertest tests in watch mode:
```sh
npm run e2e:watch
```
Run Supertest Cucumber scenarios once:
```sh
npm run cucumber
```
Run Supertest Cucumber scenarios in watch mode:
```sh
npm run cucumber:watch
```
#### Cypress
Run Cypress tests & scenarios once:
```sh
npm run cypress:run
```
Open Cypress GUI:
```sh
npm run cypress:open
```