SamplerJS demo

node v12.22.12
version: 0.3.0
endpointsharetweet
Post a JSON to get randomized data
const express = require("@runkit/runkit/express-endpoint/1.0.0"); const samplerjs = require("samplerjs"); const bodyParser = require('body-parser'); const app = express(exports); const parser = samplerjs.Parser.chanceParser; app.use(bodyParser.json()); app.get("/", (req, res) => res.send(`Post a JSON to ${process.env.RUNKIT_ENDPOINT_URL}`)); app.post("/", (req, res) => res.send(parser.parse(req.body)));
const result = parser.parse({ user: { firstName: "first", lastName: "last", tel: "phone", gender: "gender" }, description: "paragraph" });
Created from: https://npm.runkit.com/samplerjs
Loading…

no comments

    sign in to comment