You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The SDK is in early stage development and APIs and interfaces are still subject to breaking changes. We’d love your feedback as we build additional functionality!
33
+
## Usage
34
+
35
+
### Starting a new project
36
+
37
+
Install the [Nitric CLI](https://nitric.io/docs/getting-started/installation), then generate your project:
38
+
39
+
TypeScript:
40
+
41
+
```bash
42
+
nitric new hello-world ts-starter
43
+
```
44
+
45
+
JavaScript:
46
+
47
+
```bash
48
+
nitric new hello-world js-starter
49
+
```
50
+
51
+
### Adding to an existing project
52
+
53
+
First of all, you need to install the library:
54
+
55
+
```bash
56
+
npm install @nitric/sdk
57
+
```
58
+
59
+
Then you're able to import the library and create cloud resources:
60
+
61
+
```typescript
62
+
import { api, bucket } from'@nitric/sdk';
63
+
64
+
const publicApi =api('public');
65
+
const uploads =bucket('uploads').allow('write');
66
+
67
+
publicApi.get('/upload', async (ctx) => {
68
+
const photo =uploads.file('images/photo.png');
69
+
70
+
const url =awaitphoto.getUploadUrl({
71
+
expiry: 300,
72
+
});
73
+
74
+
returnctx.res.json({ url });
75
+
});
76
+
```
77
+
78
+
## Learn more
79
+
80
+
Learn more by checking out the [Nitric documentation](https://nitric.io/docs).
33
81
34
82
## Get in touch:
35
83
36
-
-Ask questions in [GitHub discussions](https://github.com/nitrictech/nitric/discussions)
84
+
-Join us on [Discord](https://nitric.io/chat)
37
85
38
-
-Join us on [Discord](https://discord.gg/Webemece5C)
86
+
-Ask questions in [GitHub discussions](https://github.com/nitrictech/nitric/discussions)
39
87
40
88
- Find us on [Twitter](https://twitter.com/nitric_io)
0 commit comments