https://github.com/bniedermeyer/json-server-schematics
Angular schematics for adding json-server(https://github.com/typicode/json-server) to your projects.
https://github.com/bniedermeyer/json-server-schematics
angular json-server schematics
Last synced: 7 months ago
JSON representation
Angular schematics for adding json-server(https://github.com/typicode/json-server) to your projects.
- Host: GitHub
- URL: https://github.com/bniedermeyer/json-server-schematics
- Owner: bniedermeyer
- Created: 2019-02-17T19:53:53.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2021-08-23T18:37:36.000Z (over 4 years ago)
- Last Synced: 2025-08-20T09:23:38.493Z (8 months ago)
- Topics: angular, json-server, schematics
- Language: HTML
- Homepage:
- Size: 293 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
[](http://commitizen.github.io/cz-cli/)
# JSON-SERVER-SCHEMATICS
This repository is a basic Schematic implementation that serves to quickly add and configure [json-server](http://commitizen.github.io/cz-cli/) to an Angular project.
### What it does
The schematic does four things:
1. Installs json-server as a dev dependency into your project
2. Creates a directory for your json server files with example `db.json` and `routes.json` files
3. Add a proxy configuration to your Angular project so that http requrests to `/api/*` will be pointed to json server
4. Adds convienience scripts to the project's `package.json` to start and serve your project with json-server or run it on its own.
## Getting Started
Call the schematic with the Angular cli and follow the prompt to tell the Schematic where to create your json-server files.
```bash
ng add json-server-schematics
```
That's all you need to do!
## Development
### Testing
To test locally, install `@angular-devkit/schematics-cli` globally and use the `schematics` command line tool. That tool acts the same as the `generate` command of the Angular CLI, but also has a debug mode.
Check the documentation with
```bash
schematics --help
```
Additionally this project has a sandbox Angular project for ease of use when developing locally. To use the Schematic in the project you must:
1. build the Schematic
2. link the Schematic to the sandbox project
3. navigate into the sandbox project and call the schematic.
4. remove created files generated by the schematic between runs
There are a number of convinience scripts included that assist in this process.
```bash
# build the project
npm run build
# link the schematic
npm run link:schematic
# execute the schematic in the sandbox
npm test
# clean the sanddbox after the test before running again
npm run clean
```
### Publishing
To publish, simply do:
```bash
npm run build
npm publish
```
That's it!