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

@r35007/mock-server

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@r35007/mock-server - npm Package Versions

1
11

13.0.2

Diff

Changelog

Source

v13.0.2

  • Fixed - Parse Error: Content-Length can't be present with Transfer-Encoding.
r35007
published 13.0.1 •

Changelog

Source

v13.0.1

  • Build issue fix.
r35007
published 13.0.0 •

Changelog

Source

v13.0.0

  • Supported JSON with comments.
  • Added bootstrap css and js file inbuilt for Homepage stylings.
  • code structural changes.
r35007
published 12.2.1 •

Changelog

Source

v12.2.1

  • Readme update.
r35007
published 12.2.0 •

Changelog

Source

v12.2.0

  • CLI breaking for an invalid path issue fixed.
r35007
published 12.1.0 •

Changelog

Source

v12.1.0

  • import other useful node packages as follows

    const {
      MockServer,
      express, // express
      lodash, // lodash
      nanoid, // nanoid
      spinner, // ora
      pathToRegexp, // path-to-regexp
      chalk, // chalk
      axios, // axios
      watcher, // chokidar.
    } = require('@r35007/mock-server');
    
  • renamed mockserver.setExpressApp() to mockserver.createExpressApp()

  • fixed - MockServer.Destroy() resets server config to default config which makes us to recreate the mockServer using MockServer.Create() method. Now we don't want to recreate MockServer instance after destroy. MockServer.Destroy() destroys the express server and resets all the data to defaults except server config.

r35007
published 12.0.0 •

Changelog

Source

v12.0.0

  • added node packages in MockServer instance

    • MockServer._ - lodash.
    • MockServer.axios - axios.
    • MockServer.express - express.
    • MockServer.chalk - chalk.
    • MockServer.watcher - chokidar.
    • MockServer.pathToRegexp - pathToRegexp.
    • MockServer.nanoid - nanoid.
    • MockServer.ora - ora
  • added setter methods to reset to defaults

    • mockserver.setDefaults() - sets default db, injectors, middlewares, store, rewriters, config
    • mockserver.setDefaultData() - sets default injectors, middlewares, store, config
    • mockserver.setDefaultDb() - sets default db
    • mockserver.setDefaultInjectors() - sets default injectors
    • mockserver.setDefaultMiddlewares() - sets default middlewares
    • mockserver.setDefaultRewriters() - sets default rewriters
    • mockserver.setDefaultStore() - sets default store
    • mockserver.setDefaultConfig() - sets default config
  • added more methods

    • mockserver.clearServerAddress() - sets current port, address, listeningTo, server to undefined
    • mockserver.setExpressApp() - create a new express app to the MockServer instance.
r35007
published 11.2.0 •

Changelog

Source

v11.2.0

  • added - log in CLI param and Config - Helps to added setter logs in console.
  • added - reply as alias for send in create router config method
const resources = mockServer.resources();
resources.create('/post').send({ name: 'foo', id: 1 });
resources.create('/comment').reply({ name: 'foo', id: 1 }); // reply is alias for send
app.use(resources.router);
r35007
published 11.1.0 •

Changelog

Source

v11.1.0

  • added - headers in routeConfigs. Now we can add custom response headers in routeConfig For Example: db.json
    {
      "/route": {
        "_config": true,
        "mock": "My Response",
        "headers": { "Content-Type": "test/plain" }
      }
    }
    
  • added - send(), status(), headers() in mockServer.resources().create() method. For Example:
    const resources = mockServer.resources();
    resources.create('/new/route/1').send('My Response').status(200).done();
    resources
      .create('/new/route/2')
      .send('https://jsonplaceholder.typicode.com/posts') //  will set to `mock` or `fetch` based on dbMode
      .headers({ 'Content-Type': 'application/json' })
      .headers('Content-Length', 123)
      .done();
    app.use(resources.router);
    
r35007
published 11.0.0 •

Changelog

Source

v11.0.0

  • renamed - _globals to globals in middlewares.

  • removed - mockServer.setDb method. Use mockServer.rewriters to set rewriters.

  • removed - mockServer.setRewriters method. Use mockServer.resources to set Db.

  • updated - mockServer.resources will now return { create, router}.

  • updated - res.locals.getDb accepts a routePath as a param. Type:

    getDb(routePath?: string | string[]): ValidTypes.RouteConfig | ValidTypes.Db;
    
  • added - mockServer.resources().create. Helps to create new route with config and mocks. For Example: server.js

    const resources = mockServer.resources();
    
    resources
      .create('/new/route', (req, res, next) => {
        next();
      })
      .mock('My Response')
      .delay(2000)
      .done();
    
    app.use(resources.router);
    
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