-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from brunolm/master
Add Examples section
- Loading branch information
Showing
20 changed files
with
413 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
title: "Nullstack Examples" | ||
description: "Check coolest stuff you can do with Nullstack" | ||
heading: "Nullstack Examples" | ||
tagline: "A collection of application examples with Nullstack." | ||
contribute: "We accept guest examples! You can write it up in markdown and open a PR to our <a href='https://github.com/nullstack/nullstack.github.io/pulls'>github repo</a>." | ||
posts: | ||
- title: "Using Nullstack as a Web API" | ||
href: "/examples/using-nullstack-as-a-web-api" | ||
description: "Nullstack can be used as a web API, you can write your own endpoints or expose server functions." | ||
- title: "Using Nullstack to build a Chrome Extension" | ||
href: "/examples/using-nullstack-to-build-a-chrome-extension" | ||
description: "Nullstack can be used to build a Chrome Extension." | ||
- title: "Using Nullstack to build a Desktop Application" | ||
href: "/examples/using-nullstack-to-build-a-desktop-application" | ||
description: "Nullstack can be used to build a Desktop Application." | ||
- title: "Using Nullstack to build a Mobile Application" | ||
href: "/examples/using-nullstack-to-build-a-mobile-application" | ||
description: "Nullstack can be used to build a Mobile Application." | ||
- title: "Using Nullstack to build a personal Portfolio on GitHub" | ||
href: "/examples/using-nullstack-to-build-a-personal-portfolio-on-github" | ||
description: "Nullstack can be used to build a personal Portfolio on GitHub." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Page Not Found | ||
description: Sorry, this is not the page you are looking for. | ||
status: 404 | ||
--- | ||
|
||
Perhaps you want to learn more about [Nullstack](/what-is-nullstack)? | ||
|
||
Or do you want to contribute to our [blog](/blog)? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: "Using Nullstack as a Web API" | ||
description: "Nullstack can be used as a web API, you can write your own endpoints or expose server functions." | ||
--- | ||
Nullstack can be used as a Web API. Nullstack runs an Express server behind the scenes allowing you to configure your own routes and build a fully customized Web API. | ||
|
||
You can configure the Express routes by using the `server` object available in the Nullstack Context on `server.js`. | ||
|
||
```js | ||
// server.js | ||
import Nullstack from 'nullstack'; | ||
import Application from './src/Application'; | ||
|
||
const context = Nullstack.start(Application); | ||
|
||
context.server.get('/api/waifus', (request, response) => { | ||
response.json({waifus: []}); | ||
}); | ||
|
||
export default context; | ||
``` | ||
|
||
It's also possible to expose server functions from your components to be in the web API. Instead of using a function that a `request` and a `response` pass the static function from your component to the express route. | ||
|
||
```js | ||
// server.js | ||
import Nullstack from 'nullstack'; | ||
import Application from './src/Application'; | ||
import WaifuComponent from './src/WaifuComponent'; | ||
|
||
const context = Nullstack.start(Application); | ||
|
||
context.server.get('/waifus', WaifuComponent.getWaifus) | ||
|
||
export default context; | ||
``` |
14 changes: 14 additions & 0 deletions
14
i18n/en-US/examples/using-nullstack-to-build-a-chrome-extension.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "Using Nullstack to build a Chrome Extension" | ||
description: "Nullstack can be used to build a Chrome Extension" | ||
--- | ||
Nullstack can be used as to build a Chrome Extension. | ||
|
||
These are all the changes required to make the app compatible as an extension: | ||
|
||
- `public/manifest.json` creates the Chrome Extension manifest file | ||
- `server.js` disables the default service worker, as the extension doesn't need it | ||
- `src/Application.jsx` is the entry component that will render the Popup code | ||
- `package.json` sets mode to SPA (default mode) and enables writing files to disk | ||
|
||
You can find a full example at [Mortaro/nullstack-chrome-extension](https://github.com/Mortaro/nullstack-chrome-extension). |
7 changes: 7 additions & 0 deletions
7
i18n/en-US/examples/using-nullstack-to-build-a-desktop-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Using Nullstack to build a Desktop Application" | ||
description: "Nullstack can be used to build a Desktop Application" | ||
--- | ||
Nullstack can be used as to build a Desktop Application with Electron. | ||
|
||
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io). |
7 changes: 7 additions & 0 deletions
7
i18n/en-US/examples/using-nullstack-to-build-a-mobile-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Using Nullstack to build a Mobile Application" | ||
description: "Nullstack can be used to build a Mobile Application" | ||
--- | ||
Nullstack can be used as to build a Mobile Application. | ||
|
||
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io). |
9 changes: 9 additions & 0 deletions
9
i18n/en-US/examples/using-nullstack-to-build-a-personal-portfolio-on-github.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: "Using Nullstack to build a personal Portfolio on GitHub" | ||
description: "Nullstack can be used to build a personal Portfolio on GitHub" | ||
--- | ||
Nullstack can be used to build a personal Portfolio on GitHub. | ||
|
||
Check out how to [deploy your website to GitHub pages](/how-to-deploy-to-github-pages). | ||
|
||
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
title: "Nullstack Examples" | ||
description: "Check coolest stuff you can do with Nullstack" | ||
heading: "Nullstack Examples" | ||
tagline: "A collection of application examples with Nullstack." | ||
contribute: "We accept guest examples! You can write it up in markdown and open a PR to our <a href='https://github.com/nullstack/nullstack.github.io/pulls'>github repo</a>." | ||
posts: | ||
- title: "Using Nullstack as a Web API" | ||
href: "/examples/using-nullstack-as-a-web-api" | ||
description: "Nullstack can be used as a web API, you can write your own endpoints or expose server functions." | ||
- title: "Using Nullstack to build a Chrome Extension" | ||
href: "/examples/using-nullstack-to-build-a-chrome-extension" | ||
description: "Nullstack can be used to build a Chrome Extension." | ||
- title: "Using Nullstack to build a Desktop Application" | ||
href: "/examples/using-nullstack-to-build-a-desktop-application" | ||
description: "Nullstack can be used to build a Desktop Application." | ||
- title: "Using Nullstack to build a Mobile Application" | ||
href: "/examples/using-nullstack-to-build-a-mobile-application" | ||
description: "Nullstack can be used to build a Mobile Application." | ||
- title: "Using Nullstack to build a personal Portfolio on GitHub" | ||
href: "/examples/using-nullstack-to-build-a-personal-portfolio-on-github" | ||
description: "Nullstack can be used to build a personal Portfolio on GitHub." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: Page Not Found | ||
description: Sorry, this is not the page you are looking for. | ||
status: 404 | ||
--- | ||
|
||
Perhaps you want to learn more about [Nullstack](/what-is-nullstack)? | ||
|
||
Or do you want to contribute to our [blog](/blog)? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: "Using Nullstack as a Web API" | ||
description: "Nullstack can be used as a web API, you can write your own endpoints or expose server functions." | ||
--- | ||
Nullstack can be used as a Web API. Nullstack runs an Express server behind the scenes allowing you to configure your own routes and build a fully customized Web API. | ||
|
||
You can configure the Express routes by using the `server` object available in the Nullstack Context on `server.js`. | ||
|
||
```js | ||
// server.js | ||
import Nullstack from 'nullstack'; | ||
import Application from './src/Application'; | ||
|
||
const context = Nullstack.start(Application); | ||
|
||
context.server.get('/api/waifus', (request, response) => { | ||
response.json({waifus: []}); | ||
}); | ||
|
||
export default context; | ||
``` | ||
|
||
It's also possible to expose server functions from your components to be in the web API. Instead of using a function that a `request` and a `response` pass the static function from your component to the express route. | ||
|
||
```js | ||
// server.js | ||
import Nullstack from 'nullstack'; | ||
import Application from './src/Application'; | ||
import WaifuComponent from './src/WaifuComponent'; | ||
|
||
const context = Nullstack.start(Application); | ||
|
||
context.server.get('/waifus', WaifuComponent.getWaifus) | ||
|
||
export default context; | ||
``` |
14 changes: 14 additions & 0 deletions
14
i18n/pt-BR/examples/using-nullstack-to-build-a-chrome-extension.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
title: "Using Nullstack to build a Chrome Extension" | ||
description: "Nullstack can be used to build a Chrome Extension" | ||
--- | ||
Nullstack can be used as to build a Chrome Extension. | ||
|
||
These are all the changes required to make the app compatible as an extension: | ||
|
||
- `public/manifest.json` creates the Chrome Extension manifest file | ||
- `server.js` disables the default service worker, as the extension doesn't need it | ||
- `src/Application.jsx` is the entry component that will render the Popup code | ||
- `package.json` sets mode to SPA (default mode) and enables writing files to disk | ||
|
||
You can find a full example at [Mortaro/nullstack-chrome-extension](https://github.com/Mortaro/nullstack-chrome-extension). |
7 changes: 7 additions & 0 deletions
7
i18n/pt-BR/examples/using-nullstack-to-build-a-desktop-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Using Nullstack to build a Desktop Application" | ||
description: "Nullstack can be used to build a Desktop Application" | ||
--- | ||
Nullstack can be used as to build a Desktop Application with Electron. | ||
|
||
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io). |
7 changes: 7 additions & 0 deletions
7
i18n/pt-BR/examples/using-nullstack-to-build-a-mobile-application.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: "Using Nullstack to build a Mobile Application" | ||
description: "Nullstack can be used to build a Mobile Application" | ||
--- | ||
Nullstack can be used as to build a Mobile Application. | ||
|
||
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io). |
9 changes: 9 additions & 0 deletions
9
i18n/pt-BR/examples/using-nullstack-to-build-a-personal-portfolio-on-github.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
title: "Using Nullstack to build a personal Portfolio on GitHub" | ||
description: "Nullstack can be used to build a personal Portfolio on GitHub" | ||
--- | ||
Nullstack can be used to build a personal Portfolio on GitHub. | ||
|
||
Check out how to [deploy your website to GitHub pages](/how-to-deploy-to-github-pages). | ||
|
||
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Translatable from "./Translatable"; | ||
|
||
class Examples extends Translatable { | ||
prepare({ page }) { | ||
page.priority = 0.3; | ||
} | ||
|
||
renderProject({ title, repository }) { | ||
return ( | ||
<a | ||
href={repository} | ||
target={repository.indexOf("http") === 0 && "_blank"} | ||
rel="noopener" | ||
class="block text-pink-600 dark:text-pink-500 border-t border-gray-100 dark:border-gray-800 py-2 mt-2" | ||
> | ||
{title} | ||
</a> | ||
); | ||
} | ||
|
||
renderPostExample({ title, href, description, date, author }) { | ||
return ( | ||
<a href={href} class="w-full block mb-8"> | ||
<h2 class="w-full text-md sm:text-xl font-light mb-2 text-pink-600"> | ||
{title} | ||
</h2> | ||
<p class="text-base" title={description}> | ||
{description} | ||
</p> | ||
</a> | ||
); | ||
} | ||
|
||
render() { | ||
if (!this.i18n) return false; | ||
return ( | ||
<section class="max-w-screen-lg mx-auto px-4 flex justify-between items-center flex-wrap py-12 sm:py-24"> | ||
<h1 class="w-full text-pink-600 text-4xl sm:text-6xl font-light block sm:mb-3"> | ||
{this.i18n.heading} | ||
</h1> | ||
<p class="text-xl sm:text-2xl font-light block mb-3"> | ||
{" "} | ||
{this.i18n.tagline} | ||
</p> | ||
<p | ||
class="w-full prose dark:prose-dark max-w-none text-xl" | ||
html={this.i18n.contribute} | ||
/> | ||
<div class="w-full mt-8"> | ||
{this.i18n.posts?.map((post) => ( | ||
<PostExample {...post} /> | ||
))} | ||
</div> | ||
</section> | ||
); | ||
} | ||
} | ||
|
||
export default Examples; |
Oops, something went wrong.