Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ashvajs/mock-server

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ashvajs/mock-server - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "@ashvajs/mock-server",
"version": "0.0.1",
"version": "0.0.2",
"dependencies": {

@@ -5,0 +5,0 @@ "fs": "^0.0.1-security",

@@ -1,11 +0,34 @@

# mock-server
# @ashvajs/mock-server
This library was generated with [Nx](https://nx.dev).
## Description
Simple mock server to serve static/dynamic routes for mock api.
## Building
Run `nx build mock-server` to build the library.
## Usage
## Running unit tests
Create your mock server object with mock server class and pass express app object with folder path.
Run `nx test mock-server` to execute the unit tests via [Jest](https://jestjs.io).
```
import path from 'path';
import express from 'express';
import { MockServer } from '@ashvajs/mock-server';
const host = process.env.HOST ?? 'localhost';
const port = process.env.PORT ? Number(process.env.PORT) : 3000;
const app = express();
const mockserver = new MockServer(
{
staticApiPath: path.resolve('apps/mock-server-example/mocks'),
},
app
);
mockserver.init();
app.listen(port, host, () => {
console.log(`[ ready ] http://${host}:${port}`);
});
```
## Examples
see `apps/mock-server-example`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc