feat: Add API key support
This commit is contained in:
71
README.md
71
README.md
@ -1,55 +1,36 @@
|
||||
# Astro Starter Kit: Basics
|
||||
# Fi3D Slicer as a Service
|
||||
|
||||
```
|
||||
npm create astro@latest -- --template basics
|
||||
```
|
||||
## API key
|
||||
|
||||
[](https://stackblitz.com/github/withastro/astro/tree/latest/examples/basics)
|
||||
[](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/basics)
|
||||
[](https://codespaces.new/withastro/astro?devcontainer_path=.devcontainer/basics/devcontainer.json)
|
||||
add `Authorization: Bearer {token}`
|
||||
|
||||
> 🧑🚀 **Seasoned astronaut?** Delete this file. Have fun!
|
||||
## API Endpoints
|
||||
|
||||

|
||||
| endpoint | method | permission required | cookie access | api access | Description |
|
||||
| :----------------------------: | :----: | :-----------------: | :-----------: | :--------: | :---------------------------------------: |
|
||||
| /api/v1/users | GET | user.list | no | no | List every user accounts |
|
||||
| /api/v1/users | POST | user.create | no | no | Create a new account |
|
||||
| /api/v1/users/{userId} | GET | user.get | yes | yes | Get a user's informations |
|
||||
| /api/v1/users/{userId} | PUT | user.set | yes | yes | Set a user's informations |
|
||||
| /api/v1/users/{userId}/configs | GET | configs.get | yes | yes | get the list of the user's configurations |
|
||||
| /api/v1/users/{userId}/configs | POST | configs.create | yes | yes | Add a new configuration to the user |
|
||||
| /api/v1/users/{userId}/keys | GET | keys.get | yes | no | get the list of API key for the user |
|
||||
| /api/v1/users/{userId}/keys | POST | keys.create | yes | no | create a new API key for the user |
|
||||
| /api/v1/users/{userId}/process | POST | slicing.slice | yes | yes | run the main website action |
|
||||
|
||||
endpoints not available through API can still be accessed by admins with the `admin.` prefix to the permission
|
||||
|
||||
## 🚀 Project Structure
|
||||
## API Key Permissions
|
||||
|
||||
Inside of your Astro project, you'll see the following folders and files:
|
||||
### `slicing:*` permissions related to the slicing
|
||||
|
||||
```
|
||||
/
|
||||
├── public/
|
||||
│ └── favicon.svg
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ │ └── Card.astro
|
||||
│ ├── layouts/
|
||||
│ │ └── Layout.astro
|
||||
│ └── pages/
|
||||
│ └── index.astro
|
||||
└── package.json
|
||||
```
|
||||
| name | Description |
|
||||
| :-----------: | :---------------------: |
|
||||
| slicing:slice | Slice the specified STL |
|
||||
|
||||
Astro looks for `.astro` or `.md` files in the `src/pages/` directory. Each page is exposed as a route based on its file name.
|
||||
### `configs:*` permissions related to the configuration files
|
||||
|
||||
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:3000` |
|
||||
| `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).
|
||||
| name | description |
|
||||
| :------------: | :--------------------------------: |
|
||||
| configs:create | Create a new configuration file |
|
||||
| configs:get | Get an existing configuration file |
|
||||
|
Reference in New Issue
Block a user