All Projects → meeshkan → Micro Jaymock

meeshkan / Micro Jaymock

Tiny API mocking microservice for generating fake JSON data.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Micro Jaymock

Micro Router
🚉 A tiny and functional router for Zeit's Micro
Stars: ✭ 621 (+404.88%)
Mutual labels:  microservice, micro
Remit
RabbitMQ-backed microservices supporting RPC, pubsub, automatic service discovery and scaling with no code changes.
Stars: ✭ 24 (-80.49%)
Mutual labels:  microservice, micro
Avatar
💎 Beautiful avatars as a microservice
Stars: ✭ 623 (+406.5%)
Mutual labels:  microservice, micro
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (+179.67%)
Mutual labels:  microservice, micro
Awesome Micro
A collection of awesome things regarding zeit's micro.
Stars: ✭ 1,053 (+756.1%)
Mutual labels:  microservice, micro
Bogus
📇 A simple and sane fake data generator for C#, F#, and VB.NET. Based on and ported from the famed faker.js.
Stars: ✭ 5,083 (+4032.52%)
Mutual labels:  fake, data
Hemera
🔬 Writing reliable & fault-tolerant microservices in Node.js https://hemerajs.github.io/hemera/
Stars: ✭ 773 (+528.46%)
Mutual labels:  microservice, micro
Go Os
Stars: ✭ 185 (+50.41%)
Mutual labels:  microservice, micro
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-60.16%)
Mutual labels:  fake, data
Microservice learning
从零开始微服务框架使用
Stars: ✭ 31 (-74.8%)
Mutual labels:  microservice, micro
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+2695.93%)
Mutual labels:  fake, data
Micro Jwt Auth
jwt authorization wrapper for https://github.com/zeit/micro
Stars: ✭ 97 (-21.14%)
Mutual labels:  microservice, micro
falso
All the Fake Data for All Your Real Needs 🙂
Stars: ✭ 877 (+613.01%)
Mutual labels:  data, fake
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+332.52%)
Mutual labels:  microservice, micro
Unfurl
Scraper for oEmbed, Twitter Cards and Open Graph metadata - fast and Promise-based ⚡️
Stars: ✭ 193 (+56.91%)
Mutual labels:  microservice, micro
Micro Analytics Cli
Public analytics as a Node.js microservice. No sysadmin experience required! 📈
Stars: ✭ 743 (+504.07%)
Mutual labels:  microservice, micro
Stack Rpc Tutorials
Stack-RPC 中文示例、教程、资料,源码解读
Stars: ✭ 1,736 (+1311.38%)
Mutual labels:  microservice, micro
Micro Cluster
Run multiple micro servers and a front proxy at a time
Stars: ✭ 173 (+40.65%)
Mutual labels:  microservice, micro
Jaymock
Minimal fake JSON test data generator.
Stars: ✭ 28 (-77.24%)
Mutual labels:  fake, data
S
a go web freamwork for micro service, very very easy to create and deploy, with auto service registry and discover, high performance and based on http/2 no ssl
Stars: ✭ 67 (-45.53%)
Mutual labels:  microservice, micro

micro-jaymock

CircleCI XO Codecov

Tiny API mocking microservice for generating fake JSON data.

Usage

Examples

Using curl:

~ ❯❯❯ curl -X POST \
        -d '{ "firstName": "name.firstName", "lastName": "name.lastName" }' \
        https://jaymock.now.sh
{"firstName":"Isaac","lastName":"Schultz"}

Using httpie:

~ ❯❯❯ http -b POST https://jaymock.now.sh \
        firstName=name.firstName lastName=name.lastName ssn=chance.ssn \
        _repeat:=3
[
    {
        "firstName": "Jalyn",
        "lastName": "Weimann",
        "ssn": "493-64-4894"
    },
    {
        "firstName": "Alvah",
        "lastName": "Ziemann",
        "ssn": "567-92-8024"
    },
    {
        "firstName": "Bennett",
        "lastName": "Russel",
        "ssn": "356-24-9256"
    }
]

Using request (Node.js):

const request = require('request')
const template = {
	firstName: 'name.firstName',
	lastName: 'name.lastName',
	ipAddresses: 'internet.ip|2'
}
request.post({url: 'https://jaymock.now.sh', json: template}, (error, response, body) => {
    if (error) {
        /* Handle error */
        console.error(error)
    }
    console.log(body)
    /*
        {
            firstName: 'Kaley',
            lastName: 'Muller',
            ipAddresses: [ '118.171.253.32', '193.234.186.225' ]
        }
    */
})

Using got (Node.js):

const got = require('got');
const template = {
    name: 'fake({{name.lastName}}, {{name.firstName}} {{name.suffix}})',
    ssn: 'chance.ssn',
    knownAddresses: {
        street: 'address.streetAddress',
        city: 'address.city',
        zipCode: 'address.zipCode',
        _repeat: 2
    }
};
(async () => {
    const {body} = await got.post('https://jaymock.now.sh', {
        json: template,
        responseType: 'json'
    });
    console.log(body);
    /*
        {
            name: 'Goodwin, Libby II',
            ssn: '368-52-3834',
            knownAddresses: [
                {
                    street: '42483 Citlalli Viaduct',
                    city: 'West Joeybury',
                    zipCode: '43966-8850'
                },
                {
                    street: '36297 Estella Throughway',
                    city: 'South Claudie',
                    zipCode: '39189-1653'
                }
            ]
        }
    */
})();

Using requests (Python 3):

import requests, json
template = {
	"accounts": {
		"name": "finance.accountName",
		"iban": "finance.iban",
		"bic": "finance.bic",
		"currentBalance": "finance.amount",
		"currency": "finance.currencyName",
		"_repeat": 2
	}
}
r = requests.post('https://jaymock.now.sh', data = json.dumps(template))
parsedFakeData = json.loads(r.text) # parse for pretty-printing
print(json.dumps(parsedFakeData, indent=4, sort_keys=True))
"""
	{
		"accounts": [
			{
				"bic": "WNRUMKJ1",
				"currency": "Turkish Lira",
				"currentBalance": "37.49",
				"iban": "CY70805008804937709053145O66",
				"name": "Credit Card Account"
			},
			{
				"bic": "LTJUMXQ1",
				"currency": "Somoni",
				"currentBalance": "98.10",
				"iban": "FI1000486540190178",
				"name": "Home Loan Account"
			}
		]
	}
"""

Development

First, clone the repository and install its dependencies:

~ ❯❯❯ git clone https://github.com/Meeshkan/micro-jaymock.git
~ ❯❯❯ cd micro-jaymock/
~/micro-jaymock ❯❯❯ npm install

Subsequently, start the development server:

~/micro-jaymock ❯❯❯ npm run dev

You can then access the service by navigating to localhost:3000.

Alternatively, you can download jaymock-cli (by running ~ ❯❯❯ npm i -g jaymock-cli), which allows you to run the development server and, consequently, mock a fake API 'globally' (by simply executing ~ ❯❯❯ jaymock --server).

Deployment

Deploy to now

Alternatively, to deploy micro-jaymock manually:

First, download now:

~ ❯❯❯ npm install -g now

Then, run now from within the micro-jaymock directory:

~/micro-jaymock ❯❯❯ now

Related

  • jaymock - API for this module
  • jaymock-cli - Mock an API and generate fake JSON test data, right from the terminal

Contributing

Thanks for wanting to contribute! We will soon have a contributing page detailing how to contribute. Meanwhile, feel free to star this repository, open issues, and ask for more features and support.

Please note that this project is governed by the Meeshkan Community Code of Conduct. By participating in this project, you agree to abide by its terms.

Credits

License

MIT © Meeshkan

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].