https://github.com/vitkarpov/grampa
🚀 A dev server that mocks your API endpoints with autogenerated data
https://github.com/vitkarpov/grampa
devserver devtools nodejs npm tools web
Last synced: 25 days ago
JSON representation
🚀 A dev server that mocks your API endpoints with autogenerated data
- Host: GitHub
- URL: https://github.com/vitkarpov/grampa
- Owner: vitkarpov
- Created: 2020-02-26T13:41:21.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-02-26T13:50:29.000Z (about 5 years ago)
- Last Synced: 2025-02-10T11:11:16.403Z (3 months ago)
- Topics: devserver, devtools, nodejs, npm, tools, web
- Homepage:
- Size: 52.7 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Grampa Simpson

🚀 A simple development server which mocks data for you.
## Examples
Let the next file be `mock-server.js`:
```js
import { Mock, server } from "grampa";server.get('/users', () => {
return new Array(5).fill(0).map({
"first_name": Mock.name(),
"second_name": Mock.name(),
"birth": Mock.date(),
"avatar": Mock.img({ w: 200, h: 200 })
});
});
server.start();
```Run it with Node.js:
```
$ node mock-server.js
Server is running on http://127.0.0.1/
```Make a request to get a list of users:
```
$ http http://127.0.0.1/users[
{
"first_name": "Bret",
"second_name": "Viktor",
"birth": "19/09/1965",
"avatar": "http://127.0.0.1/img/200x200.jpg"
},
{
"first_name": "Albert",
"second_name": "Einstein",
"birth": "01/01/2011",
"avatar": "http://127.0.0.1/img/200x200.jpg"
},
{
"first_name": "David",
"second_name": "Hilbert",
"birth": "12/07/1981",
"avatar": "http://127.0.0.1/img/200x200.jpg"
},
{
"first_name": "Alan",
"second_name": "Turing",
"birth": "11/02/1989",
"avatar": "http://127.0.0.1/img/200x200.jpg"
},
{
"first_name": "Bjarne",
"second_name": "Stroustrup",
"birth": "08/04/1973",
"avatar": "http://127.0.0.1/img/200x200.jpg"
}
]
```💪 Profit!