Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

json-server-schematics

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-server-schematics

Angular schematics for adding json-server to an Angular workspace

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

Commitizen friendly

JSON-SERVER-SCHEMATICS

This repository is a basic Schematic implementation that serves to quickly add and configure json-server to an Angular project.

What it does

The schematic does four things:

  • Installs json-server as a dev dependency into your project
  • Creates a directory for your json server files with example db.json and routes.json files
  • Add a proxy configuration to your Angular project so that http requrests to /api/* will be pointed to json server
  • 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.

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

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:

  • build the Schematic
  • link the Schematic to the sandbox project
  • navigate into the sandbox project and call the schematic.
  • remove created files generated by the schematic between runs

There are a number of convinience scripts included that assist in this process.

# 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:

npm run build
npm publish

That's it!

Keywords

schematics

FAQs

Package last updated on 23 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts