Skip to content

Commit

Permalink
add raw everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Dec 31, 2024
1 parent 41ad00d commit 0ee4c2c
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"build": "cd src/frontend && VITE_CANISTER_ORIGIN=http://$(dfx canister id backend).localhost:8000 vite build",
"build": "cd src/frontend && VITE_CANISTER_ORIGIN=http://$(dfx canister id backend).raw.localhost:8000 vite build",
"pretest": "tsx test/pretest.ts",
"test": "jest"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { customElement, property } from 'lit/decorators.js';
export class AzleApp extends LitElement {
canisterOrigin: string = `http://${
import.meta.env.VITE_CANISTER_ID
}.localhost:8000`;
}.raw.localhost:8000`;

@property()
resSendResponse: string = '';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"build": "cd src/frontend && VITE_CANISTER_ORIGIN=http://$(dfx canister id backend).localhost:$(dfx info webserver-port) VITE_IDENTITY_PROVIDER=http://$(dfx canister id internet_identity).localhost:$(dfx info webserver-port) vite build",
"build": "cd src/frontend && VITE_CANISTER_ORIGIN=http://$(dfx canister id backend).raw.localhost:$(dfx info webserver-port) VITE_IDENTITY_PROVIDER=http://$(dfx canister id internet_identity).localhost:$(dfx info webserver-port) vite build",
"pretest": "tsx test/pretest.ts",
"test": "jest"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"build": "cd src/frontend && VITE_CANISTER_ORIGIN=http://$(dfx canister id backend).localhost:$(dfx info webserver-port) VITE_IDENTITY_PROVIDER=http://$(dfx canister id internet_identity).localhost:$(dfx info webserver-port) vite build",
"build": "cd src/frontend && VITE_CANISTER_ORIGIN=http://$(dfx canister id backend).raw.localhost:$(dfx info webserver-port) VITE_IDENTITY_PROVIDER=http://$(dfx canister id internet_identity).localhost:$(dfx info webserver-port) vite build",
"pretest": "tsx test/pretest.ts",
"test": "jest"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
count=1000 # Change this number as needed

# URL to which the POST request will be sent
url="http://$(dfx canister id sqlite).localhost:8000/users/batch/1000"
url="http://$(dfx canister id sqlite).raw.localhost:8000/users/batch/1000"

# Loop as many times as specified in the count variable
for ((i=0; i<count; i++))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
count=1000 # Change this number as needed

# URL to which the POST request will be sent
url="http://$(dfx canister id sqlite_drizzle).localhost:8000/users/batch/800"
url="http://$(dfx canister id sqlite_drizzle).raw.localhost:8000/users/batch/800"

# Loop as many times as specified in the count variable
for ((i=0; i<count; i++))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
count=1000 # Change this number as needed

# URL to which the POST request will be sent
url="http://$(dfx canister id sqlite_typeorm).localhost:8000/users/batch/800"
url="http://$(dfx canister id sqlite_typeorm).raw.localhost:8000/users/batch/800"

# Loop as many times as specified in the count variable
for ((i=0; i<count; i++))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function fletchSync(canisterName: string, options: HttpRequest) {
--data "${escapeForExecSync(
Buffer.from(options.body).toString('utf-8')
)}"\
"${canisterId}.localhost:8000${options.url}" \
--resolve "${canisterId}.localhost:8000:127.0.0.1"`;
"${canisterId}.raw.localhost:8000${options.url}" \
--resolve "${canisterId}.raw.localhost:8000:127.0.0.1"`;

const responseBuffer = execSync(curlCommand);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function fletchSync(canisterName: string, options: HttpRequest) {
--data "${escapeForExecSync(
Buffer.from(options.body).toString('utf-8')
)}"\
"${canisterId}.localhost:8000${options.url}" \
--resolve "${canisterId}.localhost:8000:127.0.0.1"`;
"${canisterId}.raw.localhost:8000${options.url}" \
--resolve "${canisterId}.raw.localhost:8000:127.0.0.1"`;

const responseBuffer = execSync(curlCommand);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function fletchSync(canisterName: string, options: HttpRequest) {
--data "${escapeForExecSync(
Buffer.from(options.body).toString('utf-8')
)}"\
"${canisterId}.localhost:8000${options.url}" \
--resolve "${canisterId}.localhost:8000:127.0.0.1"`;
"${canisterId}.raw.localhost:8000${options.url}" \
--resolve "${canisterId}.raw.localhost:8000:127.0.0.1"`;

const responseBuffer = execSync(curlCommand);

Expand Down
2 changes: 1 addition & 1 deletion the_azle_book/src/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Then you use `fetch` and construct an `Authorization` header using an [@dfinity/

```typescript
const response = await fetch(
`http://bkyz2-fmaaa-aaaaa-qaaaq-cai.localhost:8000/whoami`,
`http://bkyz2-fmaaa-aaaaa-qaaaq-cai.raw.localhost:8000/whoami`,
{
method: 'GET',
headers: [['Authorization', toJwt(this.identity)]]
Expand Down
6 changes: 3 additions & 3 deletions the_azle_book/src/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dfx deploy [canisterName]

## Interacting with your canister

You will generally interact with your canister through an HTTP client such as `curl`, `fetch`, or a web browser. The URL of your canister locally will look like this: `http://[canisterId].localhost:[replicaPort]`. Azle will print your canister's URL in the terminal after a successful deploy.
You will generally interact with your canister through an HTTP client such as `curl`, `fetch`, or a web browser. The URL of your canister locally will look like this: `http://[canisterId].raw.localhost:[replicaPort]`. Azle will print your canister's URL in the terminal after a successful deploy.

```bash
# You can obtain the canisterId like this
Expand All @@ -79,10 +79,10 @@ dfx canister id [canisterName]
dfx info webserver-port

# An example of performing a GET request to a canister
curl http://a3shf-5eaaa-aaaaa-qaafa-cai.localhost:8000
curl http://a3shf-5eaaa-aaaaa-qaafa-cai.raw.localhost:8000

# An example of performing a POST request to a canister
curl -X POST -H "Content-Type: application/json" -d "{ \"hello\": \"world\" }" http://a3shf-5eaaa-aaaaa-qaafa-cai.localhost:8000
curl -X POST -H "Content-Type: application/json" -d "{ \"hello\": \"world\" }" http://a3shf-5eaaa-aaaaa-qaafa-cai.raw.localhost:8000
```

## Deploying to mainnet
Expand Down
2 changes: 1 addition & 1 deletion the_azle_book/src/servers.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Azle supports building HTTP servers on ICP using the [Node.js http.Server](https

Azle currently has good but not comprehensive support for [Node.js http.Server](https://nodejs.org/api/http.html#class-httpserver) and [Express](https://expressjs.com/). Support for other libraries like [Nest](https://nestjs.com/) are works-in-progress.

Once [deployed](./deployment.md) you can access your server at a URL like this locally `http://bkyz2-fmaaa-aaaaa-qaaaq-cai.localhost:8000` or like this on mainnet `https://bkyz2-fmaaa-aaaaa-qaaaq-cai.raw.icp0.io`.
Once [deployed](./deployment.md) you can access your server at a URL like this locally `http://bkyz2-fmaaa-aaaaa-qaaaq-cai.raw.localhost:8000` or like this on mainnet `https://bkyz2-fmaaa-aaaaa-qaaaq-cai.raw.icp0.io`.

You can use any HTTP client to interact with your server, such as `curl`, `fetch`, or a web browser. See the [Interacting with your canister section](./deployment.md#interacting-with-your-canister) of the [deployment chapter](./deployment.md) for help in constructing your canister URL.

Expand Down

0 comments on commit 0ee4c2c

Please sign in to comment.