Quickly make api endpoints used for testing.
- Sponge up all calls you make to it (prints data in console)
- Generate dummy data based on models
- No need to refresh when you change or add models
- auto-generate models when a request is sent (WIP)
- no need to clone the project just run it via the URL
Just run the server and make some calls to it, Sponge will print out information about the request you just sent.
deno run --allow-env --allow-net --allow-read --allow-write server.ts
allow write is needed here if you want to generate models from unknown requests
You can also pass in custom model folders or change the print mode:
deno run --allow-env --allow-net --allow-read --allow-write server.ts -m ./your_model_folder_path -p tree
Don't want to clone the whole repo? No problem just run it from the start file URL
deno run --allow-env --allow-net --allow-read --allow-write https://raw.githubusercontent.com/duart38/Sponge/master/server.ts
No problem. Just throw some stuff in the models folder (use asyncTest.ts as an example) and Sponge will watch for changes and reload accordingly. Here's a nice library to get you better fake data
Plugins are just regular methods that return a data type that can be sent by denos built in http module. You can add your own plugins in the plugins folder or you can use (import) already made plugins by other users directly in your models
Here's an example:
import { v4 } from "https://deno.land/std/uuid/mod.ts";
/**
* Generates a unique ID using (https://deno.land/std/uuid/mod.ts)
*/
export function uid(){
return v4.generate();
}