Skip to content

Commit c9403e9

Browse files
committed
Ask for PRs
1 parent d936309 commit c9403e9

8 files changed

+87
-13
lines changed

i18n/en-US/examples/using-nullstack-to-build-a-desktop-application.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
title: "Using Nullstack to build a Desktop Application"
33
description: "Nullstack can be used to build a Desktop Application"
44
---
5-
Nullstack can be used as to build a Desktop Application with Electron.
5+
Nullstack can be used as to build a Desktop Application with Electron.
6+
7+
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io).

i18n/en-US/examples/using-nullstack-to-build-a-mobile-application.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
title: "Using Nullstack to build a Mobile Application"
33
description: "Nullstack can be used to build a Mobile Application"
44
---
5-
Nullstack can be used as to build a Mobile Application with Capacitor.
5+
Nullstack can be used as to build a Mobile Application.
6+
7+
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io).

i18n/pt-BR/components/Examples.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ contribute: "We accept guest examples! You can write it up in markdown and open
66
posts:
77
- title: "Using Nullstack as a Web API"
88
href: "/examples/using-nullstack-as-a-web-api"
9-
description: "Nullstack can be used as a web API, and this example shows how to do it."
10-
date: "Apr, 2023"
11-
author:
12-
name: Bruno Michels
13-
handle: BrunoLM
9+
description: "Nullstack can be used as a web API, you can write your own endpoints or expose server functions."
10+
- title: "Using Nullstack to build a Chrome Extension"
11+
href: "/examples/using-nullstack-to-build-a-chrome-extension"
12+
description: "Nullstack can be used to build a Chrome Extension."
13+
- title: "Using Nullstack to build a Desktop Application"
14+
href: "/examples/using-nullstack-to-build-a-desktop-application"
15+
description: "Nullstack can be used to build a Desktop Application."
16+
- title: "Using Nullstack to build a Mobile Application"
17+
href: "/examples/using-nullstack-to-build-a-mobile-application"
18+
description: "Nullstack can be used to build a Mobile Application."
19+
- title: "Using Nullstack to build a personal Portfolio on GitHub"
20+
href: "/examples/using-nullstack-to-build-a-personal-portfolio-on-github"
21+
description: "Nullstack can be used to build a personal Portfolio on GitHub."
Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
---
22
title: "Using Nullstack as a Web API"
3-
description: "Nullstack can be used as a web API, and this example shows how to do it."
4-
date: "Apr, 2023"
5-
author:
6-
name: Bruno Michels
7-
handle: BrunoLM
3+
description: "Nullstack can be used as a web API, you can write your own endpoints or expose server functions."
84
---
9-
example
5+
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.
6+
7+
You can configure the Express routes by using the `server` object available in the Nullstack Context on `server.js`.
8+
9+
```js
10+
// server.js
11+
import Nullstack from 'nullstack';
12+
import Application from './src/Application';
13+
14+
const context = Nullstack.start(Application);
15+
16+
context.server.get('/api/waifus', (request, response) => {
17+
response.json({waifus: []});
18+
});
19+
20+
export default context;
21+
```
22+
23+
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.
24+
25+
```js
26+
// server.js
27+
import Nullstack from 'nullstack';
28+
import Application from './src/Application';
29+
import WaifuComponent from './src/WaifuComponent';
30+
31+
const context = Nullstack.start(Application);
32+
33+
context.server.get('/waifus', WaifuComponent.getWaifus)
34+
35+
export default context;
36+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: "Using Nullstack to build a Chrome Extension"
3+
description: "Nullstack can be used to build a Chrome Extension"
4+
---
5+
Nullstack can be used as to build a Chrome Extension.
6+
7+
These are all the changes required to make the app compatible as an extension:
8+
9+
- `public/manifest.json` creates the Chrome Extension manifest file
10+
- `server.js` disables the default service worker, as the extension doesn't need it
11+
- `src/Application.jsx` is the entry component that will render the Popup code
12+
- `package.json` sets mode to SPA (default mode) and enables writing files to disk
13+
14+
You can find a full example at [Mortaro/nullstack-chrome-extension](https://github.com/Mortaro/nullstack-chrome-extension).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Using Nullstack to build a Desktop Application"
3+
description: "Nullstack can be used to build a Desktop Application"
4+
---
5+
Nullstack can be used as to build a Desktop Application with Electron.
6+
7+
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Using Nullstack to build a Mobile Application"
3+
description: "Nullstack can be used to build a Mobile Application"
4+
---
5+
Nullstack can be used as to build a Mobile Application.
6+
7+
If you'd like to help complete this example, feel free to [send us a PR](https://github.com/nullstack/nullstack.github.io).
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: "Using Nullstack to build a personal Portfolio on GitHub"
3+
description: "Nullstack can be used to build a personal Portfolio on GitHub"
4+
---
5+
Nullstack can be used to build a personal Portfolio on GitHub.
6+
7+
Check out how to [deploy your website to GitHub pages](/how-to-deploy-to-github-pages).

0 commit comments

Comments
 (0)