Giter VIP home page Giter VIP logo

poc-mockserver's Introduction

Install nvm-windows

See:

$ nvm install latest
...

$ nvm use latest
Now using node v19.8.1 (64-bit)

$ node --version
v19.8.1

Create Node.js Project

See:

$ npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See `npm help init` for definitive documentation on these fields
and exactly what they do.

Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (mockserver)
version: (1.0.0)
description: Playing with @r35007/mock-server
entry point: (index.js)                                                                                                                                           
test command:                                                                                                                                                     
git repository: https://github.com/ivangeorgiev/poc-mockserver                                                                                                    
keywords:                                                                                                                                                         
author: Ivan Georgiev                                                                                                                                             
license: (ISC) GPL-3.0-or-later
About to write to C:\Sandbox\PoC\vscode\mockserver\package.json:

{
  "name": "mockserver",
  "version": "1.0.0",
  "description": "Playing with @r35007/mock-server",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/ivangeorgiev/poc-mockserver.git"
  },
  "author": "Ivan Georgiev",
  "license": "GPL-3.0-or-later",
  "bugs": {
    "url": "https://github.com/ivangeorgiev/poc-mockserver/issues"
  },
  "homepage": "https://github.com/ivangeorgiev/poc-mockserver#readme"
}


Is this OK? (yes)

Install Mock Server

See:

$ npm install -g @r35007/mock-server

added 156 packages in 21s

Create db.json:

{
    "posts": [{ "id": 1, "title": "mock-server", "author": "r35007" }],
    "comments": [{ "id": 1, "body": "some comment", "postId": 1 }],
    "profile": { "name": "r35007" }
}
$ mock-server --watch ./db.json

{^_^}/~ Hi!

Mock Server Started!

Access URLs:
-----------------------------------
Localhost: http://localhost:3000
      LAN: http://::1:3000
-----------------------------------
Press CTRL+C to stop

listening...
Number of routes: 8


Type s + enter at any time to create a snapshot of the database
$ npm install -g nodemon
# Without this for some reason server.js could not find the mock-server
$ npm install --save-develop @r35007/mock-server

poc-mockserver's People

Contributors

ivangeorgiev avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.