Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yogyy/fastify-starter
learning backend(js framework)
https://github.com/yogyy/fastify-starter
fastify jwt starter
Last synced: about 1 month ago
JSON representation
learning backend(js framework)
- Host: GitHub
- URL: https://github.com/yogyy/fastify-starter
- Owner: yogyy
- Created: 2024-01-31T15:40:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-26T14:35:41.000Z (9 months ago)
- Last Synced: 2024-05-30T02:21:41.356Z (7 months ago)
- Topics: fastify, jwt, starter
- Language: JavaScript
- Homepage: https://fastify-starter-yogyy.vercel.app
- Size: 125 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Getting Started with [Fastify-CLI](https://www.npmjs.com/package/fastify-cli)
This project was bootstrapped with Fastify-CLI.
## Create Table
```bash
CREATE TABLE fastify_users (
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
createdAt DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
updatedAt DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
email VARCHAR(191) NOT NULL UNIQUE,
hash VARCHAR(191) NOT NULL,
firstName VARCHAR(191),
lastName VARCHAR(191)
);
```#### POST /api/auth/signup
```json
{
"email": "[email protected]",
"password": "123",
"firstName": "tester",
"lastName": "?" // optional
}
```#### POST /api/auth/signin
```json
{ "email": "[email protected]", "password": "123" }
```#### GET /api/users/details , /api/users/:id
```js
/**
* Require Authorization in headers.
*
* Usage:
* - Include 'Authorization' in headers.
* - Use 'Bearer [token]' as the value for the Authorization header.
* - Obtain the token after signup or signin.
*
* GET /api/users/details
* - Retrieve details of the authenticated user.
* - Authorization token must be included in headers.
*
* GET /api/users/:id
* - Retrieve details of a specific user by ID.
* - Requires user ID as a parameter in the URL.
* - Authorization token must be included in headers.
*/
```### Route
#### basic route
```js
/**
* GET /api
* GET /api/ping
* GET /api/hello
* - { name, age } in body
* GET /api/hello/:id
* - { id } in params
* /
```## Available Scripts
### `npm run dev`
To start the app in dev mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.### `npm start`
For production mode
### `npm run test`
Read [testing docs](https://node-tap.org/basics/)
Run the test cases.
## Learn More
To learn Fastify, check out the [Fastify documentation](https://www.fastify.io/docs/latest/).