Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
proxima812 committed Apr 8, 2024
0 parents commit 759cef6
Show file tree
Hide file tree
Showing 34 changed files with 10,610 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/_studio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Astro Studio

env:
ASTRO_STUDIO_APP_TOKEN: ${{secrets.ASTRO_STUDIO_APP_TOKEN }}

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]

jobs:
DB:
permissions:
contents: read
actions: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: jaid/action-npm-install@v1.2.1
- uses: withastro/action-studio@main
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Astro Starter Kit: Minimal

```sh
npm create astro@latest -- --template minimal
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/minimal)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/minimal)
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/minimal/devcontainer.json)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
## 🚀 Project Structure

Inside of your Astro project, you'll see the following folders and files:

```text
/
├── public/
├── src/
│ └── pages/
│ └── index.astro
└── package.json
```

Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.

There's nothing special about `src/components/`, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.

Any static assets, like images, can be placed in the `public/` directory.

## 🧞 Commands

All commands are run from the root of the project, from a terminal:

| Command | Action |
| :------------------------ | :----------------------------------------------- |
| `npm install` | Installs dependencies |
| `npm run dev` | Starts local dev server at `localhost:4321` |
| `npm run build` | Build your production site to `./dist/` |
| `npm run preview` | Preview your build locally, before deploying |
| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `npm run astro -- --help` | Get help using the Astro CLI |

## 👀 Want to learn more?

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
# astro-4.5-test-db-crud
# test-crud-lucia-astroDB
# test-crud-lucia-astroDB
12 changes: 12 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import db from "@astrojs/db"
import tailwind from "@astrojs/tailwind"
import { defineConfig } from "astro/config"
import react from "@astrojs/react"
import netlify from "@astrojs/netlify"

// https://astro.build/config
export default defineConfig({
integrations: [db(), tailwind(), react()],
output: "server",
adapter: netlify(),
})
38 changes: 38 additions & 0 deletions db/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { column, defineDb, defineTable } from "astro:db"

const User = defineTable({
columns: {
id: column.text({ primaryKey: true, optional: false, unique: true }),
username: column.text({ unique: true, optional: false }),
password: column.text({ optional: true }),
},
})

const Session = defineTable({
columns: {
id: column.text({ optional: false, unique: true }),
userId: column.text({ optional: false, references: () => User.columns.id }),
expiresAt: column.number({ optional: false }),
},
})

const Post = defineTable({
columns: {
id: column.number({ primaryKey: true }),
// userId: column.text({ references: () => User.columns.id }),
title: column.text(),
description: column.text(),
},
})

const Like = defineTable({
columns: {
postSlug: column.text({ primaryKey: true }),
likesCount: column.number({ default: 0 }),
},
})

// https://astro.build/db/config
export default defineDb({
tables: { Post, Like, User, Session },
})
13 changes: 13 additions & 0 deletions db/seed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { db, Post } from "astro:db"

// https://astro.build/db/seed
export default async function seed() {
await db.insert(Post).values([
{
title: "Google",
description:
"I found this cool site that can let you say anything you want without accountability!",
},
])

}
Loading

0 comments on commit 759cef6

Please sign in to comment.