|
1 |
| -# create-svelte |
| 1 | +# install counter |
2 | 2 |
|
3 |
| -Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte). |
| 3 | +A simple firebase + svelte project to count udroid installations. |
4 | 4 |
|
5 |
| -## Creating a project |
| 5 | +## Working |
6 | 6 |
|
7 |
| -If you're seeing this, you've probably already done this step. Congrats! |
| 7 | +- Svelte is used to create simple server side functions to increment the counter and return the current count. |
| 8 | +- vercel is used to deploy the serverless functions ( :heart: vercel ) |
| 9 | +- Firebase to store the count and serve |
8 | 10 |
|
9 |
| -```bash |
10 |
| -# create a new project in the current directory |
11 |
| -npm create svelte@latest |
| 11 | +## Endpoints |
12 | 12 |
|
13 |
| -# create a new project in my-app |
14 |
| -npm create svelte@latest my-app |
15 |
| -``` |
| 13 | +|Endpoint| Description | |
| 14 | +|--|--| |
| 15 | +| `/count` | to increment the count and return the current count | |
| 16 | +| `/cur_count` | to return the current count | |
16 | 17 |
|
17 |
| -## Developing |
| 18 | +> No extra parameters are required for the endpoints |
18 | 19 |
|
19 |
| -Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: |
| 20 | +## Usage |
20 | 21 |
|
21 |
| -```bash |
22 |
| -npm run dev |
| 22 | +check out `.env.example` to create a `.env` file |
23 | 23 |
|
24 |
| -# or start the server and open the app in a new browser tab |
25 |
| -npm run dev -- --open |
26 |
| -``` |
27 | 24 |
|
28 |
| -## Building |
| 25 | +```bash |
| 26 | +curl https://endpoints-url/count |
| 27 | +``` |
29 | 28 |
|
30 |
| -To create a production version of your app: |
| 29 | +returns a json response |
31 | 30 |
|
32 |
| -```bash |
33 |
| -npm run build |
| 31 | +```cmd |
| 32 | +{"downloads":908} |
34 | 33 | ```
|
35 | 34 |
|
36 |
| -You can preview the production build with `npm run preview`. |
| 35 | +> Please don't spam the endpoints :pray: |
| 36 | +
|
| 37 | +## License |
37 | 38 |
|
38 |
| -> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment. |
| 39 | +MIT |
0 commit comments