https://github.com/trapvincenzo/deno-http-simple-mock
Simple HTTP Server mocker written in Deno
https://github.com/trapvincenzo/deno-http-simple-mock
deno fake-data http-server mock
Last synced: about 2 months ago
JSON representation
Simple HTTP Server mocker written in Deno
- Host: GitHub
- URL: https://github.com/trapvincenzo/deno-http-simple-mock
- Owner: trapvincenzo
- Created: 2020-05-19T19:56:34.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-19T19:59:32.000Z (about 6 years ago)
- Last Synced: 2025-06-15T11:03:23.116Z (about 1 year ago)
- Topics: deno, fake-data, http-server, mock
- Language: TypeScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DENO Http simple mock
Creates a server that returns mock data using a config file.
## Run it
`deno run --allow-net --allow-read server.ts`
## Config file
These are the specs (`models.ts`)
```
export interface HSMRoute {
path: string;
method: string;
responseText?: string;
responseFile?: string;
}
export interface HSMConfig {
routes: HSMRoute[];
port: 8000;
}
export enum HSMMethod {
GET = "get",
POST = "post",
}
```
## Config example
```
{
"routes": [
{
"path": "/test",
"method": "GET",
"responseText": "{\"hello\":\"world\"}"
},
{
"path": "/test2",
"method": "GET",
"responseFile": "./test2.json"
}
],
"port": 8000
}
```