Skip to content

zhr85210078/fastify-template-server

Repository files navigation

🚀 fastify-template-server

fastify api server (the project inspiration comes from fastify-ts-starter)

🔥 Pre operational conditions

  • be ready to nodejs
  • be ready to mysql
  • modify database related information

💡 Prepare the user table, it's just a demo

CREATE TABLE `user` (
    `id` int NOT NULL AUTO_INCREMENT,
    `username` varchar(255) NOT NULL,
    `pwd` varchar(255) NOT NULL,
    `salt` varchar(255) NOT NULL,
    `email` varchar(255) NOT NULL,
    `deletedAt` timestamp NULL DEFAULT NULL,
    `createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
    `updatedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
)  

🌈 Install dependency packages

pnpm i

🌟 Local packaging

pnpm run build

🎉 Run locally

pnpm run start

🏆 API

1. Get version

  • HTTP method: GET

  • Request URL: http://[domain]/api/version

  • Response parameters:

parameters subparameters type description
statuscode - int Status code 200 indicates success, non 200 indicates failure
message - string Reminder information
data - string Return results
  • Response example:
    {
      "statuscode": 200,
      "message": "success",
      "data": "v1.0.0"
    }

About

A simple template to start a new Fastify project with TypeScript Topics

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published