Skip to content

Commit ab5d8a5

Browse files
committed
chore: wip
1 parent f44d102 commit ab5d8a5

File tree

8 files changed

+55
-20
lines changed

8 files changed

+55
-20
lines changed

.github/CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Contributing
22

3+
WIP: Updates to here are in progress.
4+
35
First off, thank you for taking the time to contribute to the Stacks ecosystem ❤️
46

57
> **Note**

.stacks/core/cloud/src/cloud.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { app, cloud } from '@stacksjs/config'
2222

2323
export class StacksCloud extends Stack {
2424
domain: string
25-
apiDomain: string
25+
apiPath: string
2626
docsDomain: string
2727
apiVanityUrl?: string
2828
vanityUrl: string
@@ -48,7 +48,7 @@ export class StacksCloud extends Stack {
4848
throw new Error('Your ./config app.url needs to be defined in order to deploy. You may need to adjust the APP_URL inside your .env file.')
4949

5050
this.domain = app.url
51-
this.apiDomain = `${app.url}/api`
51+
this.apiPath = 'api'
5252
this.docsDomain = app.docMode ? app.url : `${app.url}/docs`
5353
this.docsSource = '../../../storage/framework/docs'
5454
this.websiteSource = app.docMode ? this.docsSource : '../../../storage/public'
@@ -319,8 +319,9 @@ export class StacksCloud extends Stack {
319319

320320
behaviorOptions = {
321321
'/api/*': {
322-
origin: new origins.HttpOrigin(this.apiDomain, {
323-
originPath: '/',
322+
origin: new origins.HttpOrigin(this.domain, {
323+
originPath: '/api',
324+
protocolPolicy: cloudfront.OriginProtocolPolicy.HTTPS_ONLY,
324325
}),
325326
compress: true,
326327
allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
@@ -337,6 +338,7 @@ export class StacksCloud extends Stack {
337338
'/docs/*': {
338339
origin: new origins.S3Origin(this.storage.publicBucket, {
339340
originAccessIdentity: this.originAccessIdentity,
341+
originPath: '/docs',
340342
}),
341343
compress: true,
342344
allowedMethods: this.allowedMethodsFromString(cloud.cdn?.allowedMethods),
@@ -364,7 +366,7 @@ export class StacksCloud extends Stack {
364366
})
365367

366368
new Output(this, 'ApiUrl', {
367-
value: `https://${this.apiDomain}`,
369+
value: `https://${this.domain}/${this.apiPath}`,
368370
description: 'The URL of the deployed application',
369371
})
370372

.stacks/core/env/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export interface Env {
99
APP_URL: string
1010
APP_DEBUG: boolean
1111
APP_BUCKET: string
12+
API_PATH: string
1213

1314
DB_CONNECTION: string
1415
DB_HOST: string

.stacks/core/types/src/api.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* **API Options**
3+
*
4+
* This configuration defines all of your API options. Because Stacks is fully-typed, you
5+
* may hover any of the options below and the definitions will be provided. In case you
6+
* have any questions, feel free to reach out via Discord or GitHub Discussions.
7+
*/
8+
export interface ApiOptions {
9+
/**
10+
* **API Path**
11+
*
12+
* This is the path that will be used for all API routes. For example, if you set this
13+
* to `api`, then your routes will be `/api/user`, `/api/posts`, etc.
14+
*
15+
* @default string "api"
16+
* @example string "api"
17+
* @example string "api/v1"
18+
* @example string "api/v2/"
19+
* @example string "/api/v2"
20+
*/
21+
path: string
22+
}
23+
24+
export type ApiConfig = Partial<ApiOptions>

.stacks/core/types/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './api'
12
export * from './app'
23
export * from './auto-imports'
34
export * from './binary'

config/api.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { ApiConfig } from '@stacksjs/types'
2+
import { env } from '@stacksjs/env'
3+
4+
/**
5+
* **API Configuration**
6+
*
7+
* This configuration defines all of your API options. Because Stacks is fully-typed, you
8+
* may hover any of the options below and the definitions will be provided. In case you
9+
* have any questions, feel free to reach out via Discord or GitHub Discussions.
10+
*/
11+
export default {
12+
path: env.API_PATH || '/api',
13+
} satisfies ApiConfig

config/docs.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,23 @@ const nav = [
1616
items: [
1717
{
1818
text: 'Twitter',
19-
link: 'https://twitter.com/vite_js',
19+
link: 'https://twitter.com/stacksjs',
2020
},
2121
{
2222
text: 'Discord Chat',
23-
link: 'https://chat.vitejs.dev',
23+
link: 'https://discord.gg/stacksjs',
2424
},
2525
{
26-
text: 'Awesome Vite',
27-
link: 'https://github.com/vitejs/awesome-vite',
28-
},
29-
{
30-
text: 'DEV Community',
31-
link: 'https://dev.to/t/vite',
32-
},
33-
{
34-
text: 'Rollup Plugins Compat',
35-
link: 'https://vite-rollup-plugins.patak.dev/',
26+
text: 'Awesome Stacks',
27+
link: 'https://github.com/stacksjs/awesome-stacks',
3628
},
3729
{
3830
text: 'Changelog',
39-
link: 'https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md',
31+
link: 'https://github.com/stacksjs/stacks/blob/main/CHANGELOG.md',
4032
},
4133
{
4234
text: 'Contributing',
43-
link: 'https://github.com/vitejs/vite/blob/main/CONTRIBUTING.md',
35+
link: 'https://github.com/stacksjs/stacks/blob/main/.github/CONTRIBUTING.md',
4436
},
4537
],
4638
},

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ titleTemplate: Modern TypeScript Fullstack Development.
66

77
hero:
88
name: Stacks
9-
text: Build. Ship. Faster.
9+
text: Build. Ship. Faster
1010
tagline: Rapid application, cloud & library development framework. For the best full-stack teams.
1111
actions:
1212
- theme: brand

0 commit comments

Comments
 (0)