diff --git a/components/markdown.tsx b/components/markdown.tsx index d2c36eb5..fa4e18a2 100644 --- a/components/markdown.tsx +++ b/components/markdown.tsx @@ -1,7 +1,6 @@ import { slug } from 'github-slugger'; import { Children, FunctionComponent } from 'react'; import ReactMarkdown from 'react-markdown'; -import rehypeExternalLinks from 'rehype-external-links'; import rehypeRaw from 'rehype-raw'; import remarkGfm from 'remark-gfm'; import { urlTransform } from '../utils/url'; @@ -85,10 +84,7 @@ const Markdown: FunctionComponent<{ return ( { diff --git a/content/blog/mockoon-new-api-playground.md b/content/blog/mockoon-new-api-playground.md new file mode 100644 index 00000000..651e28ce --- /dev/null +++ b/content/blog/mockoon-new-api-playground.md @@ -0,0 +1,50 @@ +--- +title: Mockoon new API playground +excerpt: 'Discover Mockoon new API playground, a ready-to-use mock API for all your prototyping needs.' +date: '2023-12-20' +image: mockoon-api-playground.png +imageAlt: mockoon logo with application screenshot +imageWidth: 1200 +imageHeight: 400 +meta: + title: Mockoon new API playground + description: 'Discover Mockoon new API playground, a ready-to-use mock API for all your prototyping needs: fake JSON data, JSON placeholders, realistic CRUD API mock, etc.' +--- + +🥳 We are happy to announce the release of a new tool: the [API playground](/playground/). + +It is a **free and ready-to-use mock API** offering multiple CRUD endpoints with fake data. The perfect tool to quickly prototype your frontend applications, test your API calls, or learn about APIs. + +## 🔎 How to use the API playground? + +The API playground is available at [`https://playground.mockoon.com`](https://playground.mockoon.com) and offers different resources containing fake data: [`/contacts`](https://playground.mockoon.com/contacts), [`/movies`](https://playground.mockoon.com/movies), [`/photos`](https://playground.mockoon.com/photos), [`/posts`](https://playground.mockoon.com/posts), [`/todos`](https://playground.mockoon.com/todos), [`/users`](https://playground.mockoon.com/users). They work like any other API with various endpoints and CRUD operations, like GET, POST, PUT, PATCH and DELETE. + +Even better, all actions like updates or deletes are **persisted** (until the next reset 😉)! Making it a great tool to test your frontend applications in a more realistic environment. + +> ➡️ Head over to the [API playground documentation](https://mockoon.com/playground/) to learn more! + +## ⚙️ How we built the API playground + +All the fake data were generated using Faker.js and our [templating system](/docs/latest/templating/overview/). We picked some from our list of [templates 📃](/templates/) and created some new ones using our [AI assistant 🤖](/ai-powered-api-mocking/). + +We then created a Mockoon project with all the [CRUD endpoints](/docs/latest/api-endpoints/crud-routes/). CRUD endpoints are fully automated and create multiple routes at runtime to let you manipulate a [data bucket](/docs/latest/data-buckets/overview/), a sort of basic JSON database. + +![Mockoon CRUD endpoints](/images/blog/mockoon-new-api-playground/creating-crud-endpoints-mockoon-desktop.png) + +We saved the project data file in a [new repository](https://github.com/mockoon/playground) and created a **Dockerfile** using Mockoon CLI. + +Here is the command we used: `mockoon-cli dockerize -d ./dist/playground-mock.json -o ./dist/Dockerfile -p 8080`. +The CLI `dockerize` command will generate a Dockerfile with all the necessary instructions to run your mock (`COPY`, `EXPOSE`, etc.). + +Finally, we **deployed** the mock API on Google Cloud Run, using Cloud Build. Setting up Cloud Build was a breeze, and we were able to deploy the API playground in a few minutes. +After authenticating Cloud Build with GitHub, it will listen for pushes on a specific branch of the repository (here `main`) and then build and deploy the Docker image to Cloud Run based on the provided Dockerfile. + +This way, we can easily update the playground API by simply pushing a new version of the repository. + +We also use Cloudflare rate limiting to prevent abuse and ensure the API playground is always available. + +## 🤝 Contribute to the API playground + +The API playground is open-source and available on [GitHub](https://github.com/mockoon/playground). Feel free to contribute by adding new resource endpoints or reporting any issues you may encounter. + +Happy mocking! 🚀 diff --git a/content/blog/september-2023-news.md b/content/blog/september-2023-news.md index 3fdad937..c1a72513 100644 --- a/content/blog/september-2023-news.md +++ b/content/blog/september-2023-news.md @@ -19,19 +19,19 @@ In this update, we have a lot to share since June, including exciting new featur ## 📦 New releases -We have released three new versions since the last June newsletter, as we have moved to a monthly release schedule. [4.0.0](https://mockoon.com/releases/4.0.0/) (July), [4.1.0](https://mockoon.com/releases/4.1.0/) (August) and [5.0.0](https://mockoon.com/releases/5.0.0/) (September). Among the new features and changes: +We have released three new versions since the last June newsletter, as we have moved to a monthly release schedule. [4.0.0](/releases/4.0.0/) (July), [4.1.0](/releases/4.1.0/) (August) and [5.0.0](/releases/5.0.0/) (September). Among the new features and changes: -- **JSONPath support**: Mockoon now supports JSONPath alongside object-path everywhere a path to an object property can be provided: in templating helpers like data, body and queryParam, in the response rules path, etc. 📘 [Read more](https://mockoon.com/releases/5.0.0/#jsonpath-support) -- **Logging**: Logging has been standardized across all Mockoon applications and packages. The logs will now be formatted the same way in the desktop application log file, the CLI's console and log file, and the serverless package's console logging. 📘 [Read more](https://mockoon.com/releases/4.0.0/#logs-standardization-and-credentials-filtering) -- **CLI changes**: We refactored the CLI to remove the dependency to PM2, which was subject to some security vulnerabilities. Another reason for this refactoring, was that, having multiple other ways to manage running CLI instances (i.e. containers), embedding a process manager felt a bit outdated and overkill. The CLI is now easier to maintain and more lightweight. As a consequence multiple flags and options disappeared, and running the CLI as a foreground process is now the default. 📘 [Read more](https://mockoon.com/releases/4.0.0/#cli) -- **Response fallback mode**: A new response mode has been added. It allows you to fallback to the next route and ultimately the proxied server when no response rules match instead of serving the default response. 📘 [Read the documentation](https://mockoon.com/docs/latest/route-responses/multiple-responses/#fallback-mode) -- **HTTP methods**: It is now possible to create routes that will match any HTTP method by selecting "All methods" in the routes method dropdown. 📘 [Read more](https://mockoon.com/releases/5.0.0/#routes-targeting-all-http-methods) -- **OpenAPI support improvements**: When exporting to OpenAPI format, inline bodies are now used to populate the example property. 📘 [Read more](https://mockoon.com/releases/4.0.0/#openapi) -- **And more**: [templating support in rules](https://mockoon.com/releases/4.1.0/#dynamic-rules-with-templating), [new array filtering templating helper](https://mockoon.com/releases/4.1.0/#changes-to-templating-helpers). +- **JSONPath support**: Mockoon now supports JSONPath alongside object-path everywhere a path to an object property can be provided: in templating helpers like data, body and queryParam, in the response rules path, etc. 📘 [Read more](/releases/5.0.0/#jsonpath-support) +- **Logging**: Logging has been standardized across all Mockoon applications and packages. The logs will now be formatted the same way in the desktop application log file, the CLI's console and log file, and the serverless package's console logging. 📘 [Read more](/releases/4.0.0/#logs-standardization-and-credentials-filtering) +- **CLI changes**: We refactored the CLI to remove the dependency to PM2, which was subject to some security vulnerabilities. Another reason for this refactoring, was that, having multiple other ways to manage running CLI instances (i.e. containers), embedding a process manager felt a bit outdated and overkill. The CLI is now easier to maintain and more lightweight. As a consequence multiple flags and options disappeared, and running the CLI as a foreground process is now the default. 📘 [Read more](/releases/4.0.0/#cli) +- **Response fallback mode**: A new response mode has been added. It allows you to fallback to the next route and ultimately the proxied server when no response rules match instead of serving the default response. 📘 [Read the documentation](/docs/latest/route-responses/multiple-responses/#fallback-mode) +- **HTTP methods**: It is now possible to create routes that will match any HTTP method by selecting "All methods" in the routes method dropdown. 📘 [Read more](/releases/5.0.0/#routes-targeting-all-http-methods) +- **OpenAPI support improvements**: When exporting to OpenAPI format, inline bodies are now used to populate the example property. 📘 [Read more](/releases/4.0.0/#openapi) +- **And more**: [templating support in rules](/releases/4.1.0/#dynamic-rules-with-templating), [new array filtering templating helper](/releases/4.1.0/#changes-to-templating-helpers). ## 📏 Global rules -Thanks to the [response fallback mode](https://mockoon.com/docs/latest/route-responses/multiple-responses/#fallback-mode) introduced in [v4.1.0](https://mockoon.com/releases/4.1.0/), it is now possible to create wildcard routes containing global rules, such as validating the presence of an Authorization header or verifying that the request body contains a specific property. Head over to our new [Global routes with rules](https://mockoon.com/docs/latest/route-responses/global-routes-with-rules/) documentation section to learn how to create reusable responses and rules and apply them to all your routes. +Thanks to the [response fallback mode](/docs/latest/route-responses/multiple-responses/#fallback-mode) introduced in [v4.1.0](/releases/4.1.0/), it is now possible to create wildcard routes containing global rules, such as validating the presence of an Authorization header or verifying that the request body contains a specific property. Head over to our new [Global routes with rules](/docs/latest/route-responses/global-routes-with-rules/) documentation section to learn how to create reusable responses and rules and apply them to all your routes. ![application screenshot with a wildcard route{599x329}](/images/blog/september-2023-news/create-wildcard-route.png) @@ -53,10 +53,10 @@ We have recently removed Google Analytics from our website as part of our commit ## 🤝 OSS friends -We have partnered with several other open-source projects that we admire and wish to support. Feel free to [explore them!](https://mockoon.com/oss-friends/) +We have partnered with several other open-source projects that we admire and wish to support. Feel free to [explore them!](/oss-friends/) ![screenshot of the OSS friends page showing a grid of project names and descriptions{1150x735}](/images/blog/september-2023-news/oss-friends.png) ## 🛠️ Custom services -We now offer [custom services](https://mockoon.com/custom-services/) to help you get started with Mockoon through training, support, and custom development. [Contact us](https://mockoon.com/contact-form/) for more information. +We now offer [custom services](/custom-services/) to help you get started with Mockoon through training, support, and custom development. [Contact us](/contact-form/) for more information. diff --git a/package-lock.json b/package-lock.json index 39bc4f3c..7c7f1518 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "react-hook-form": "^7.48.2", "react-markdown": "^9.0.0", "react-syntax-highlighter": "^15.5.0", - "rehype-external-links": "^3.0.0", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.0", "sass": "^1.69.5", @@ -8380,18 +8379,6 @@ "url": "https://opencollective.com/unified" } }, - "node_modules/hast-util-is-element": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", - "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", - "dependencies": { - "@types/hast": "^3.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/hast-util-parse-selector": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz", @@ -8958,17 +8945,6 @@ "node": ">= 0.10" } }, - "node_modules/is-absolute-url": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz", - "integrity": "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==", - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-alphabetical": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", @@ -13324,23 +13300,6 @@ "jsesc": "bin/jsesc" } }, - "node_modules/rehype-external-links": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rehype-external-links/-/rehype-external-links-3.0.0.tgz", - "integrity": "sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw==", - "dependencies": { - "@types/hast": "^3.0.0", - "@ungap/structured-clone": "^1.0.0", - "hast-util-is-element": "^3.0.0", - "is-absolute-url": "^4.0.0", - "space-separated-tokens": "^2.0.0", - "unist-util-visit": "^5.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/unified" - } - }, "node_modules/rehype-raw": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", @@ -22792,14 +22751,6 @@ } } }, - "hast-util-is-element": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-3.0.0.tgz", - "integrity": "sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==", - "requires": { - "@types/hast": "^3.0.0" - } - }, "hast-util-parse-selector": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.5.tgz", @@ -23223,11 +23174,6 @@ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", "dev": true }, - "is-absolute-url": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-absolute-url/-/is-absolute-url-4.0.1.tgz", - "integrity": "sha512-/51/TKE88Lmm7Gc4/8btclNXWS+g50wXhYJq8HWIBAGUBnoAdRu1aXeh364t/O7wXDAcTJDP8PNuNKWUDWie+A==" - }, "is-alphabetical": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.4.tgz", @@ -26422,19 +26368,6 @@ } } }, - "rehype-external-links": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rehype-external-links/-/rehype-external-links-3.0.0.tgz", - "integrity": "sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw==", - "requires": { - "@types/hast": "^3.0.0", - "@ungap/structured-clone": "^1.0.0", - "hast-util-is-element": "^3.0.0", - "is-absolute-url": "^4.0.0", - "space-separated-tokens": "^2.0.0", - "unist-util-visit": "^5.0.0" - } - }, "rehype-raw": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-7.0.0.tgz", diff --git a/package.json b/package.json index ef815a6a..dac4c030 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "react-hook-form": "^7.48.2", "react-markdown": "^9.0.0", "react-syntax-highlighter": "^15.5.0", - "rehype-external-links": "^3.0.0", "rehype-raw": "^7.0.0", "remark-gfm": "^4.0.0", "sass": "^1.69.5", diff --git a/pages/playground.tsx b/pages/playground.tsx index b2dd7ac3..a6eb12c8 100644 --- a/pages/playground.tsx +++ b/pages/playground.tsx @@ -115,7 +115,7 @@ const resources: AccordionData = [ (uri: string) => { return uri; }; - -/** - * Set target for outgoing links - * - * @param uri - */ -export const linkTarget = (uri: string) => { - if (uri.startsWith('http')) { - return '_blank'; - } -};