GithubHelp home page GithubHelp logo

fastifystarter's Introduction

FastifyStarter

My personnal starter for fastify project.

Tech

  • fastify
  • knex
  • objection
  • i18n
  • @exodus/schemasafe
  • role-acl
  • bcryptjs
  • jwt
  • lorenwest/node-config
  • codeBelt/generate-template-files
  • nodemailer

Installation

requires Node.js to run.

Clone, install the dependencies and devDependencies and start the server.

$ npm install

Generate your first service (example restaurant)

$ npm run generate

Create Model -> restaurant -> Output path: ./app/models/
Create Service -> restaurant -> Output path: ./app/services/restaurant
Create Migration -> restaurant -> Output path: ./database/migrations/restaurant.js
Create Seed -> restaurant -> Output path: ./database/seeds/restaurant.js

$ npm run db:reset

Add your service in server.js

fastify.register(require("./services/restaurant"));

Launch the server

$ npm run dev

Urls :
GET http://localhost:3030/api/restaurant/
GET http://localhost:3030/api/restaurant/1
POST http://localhost:3030/api/restaurant/ (with body json {name:"foo"} )
PUT http://localhost:3030/api/restaurant/ (with body json {id:1,name:"foo correct"} )
DELETE http://localhost:3030/api/restaurant/1

Others :
POST http://localhost:3030/api/auth/login (with body json {email:"[email protected]","password":"demo"} )
POST http://localhost:3030/api/auth/register (with body json {email:"[email protected]","password":"demo"} )
GET http://localhost:3030/api/auth/me (with Bearer )

GET http://localhost:3030/api/user/ (superadmin permission)
GET http://localhost:3030/api/user/1 (superadmin permission)
POST http://localhost:3030/api/user/ (with body json {email:"foo", password:"", etc...} ) (superadmin permission)
PUT http://localhost:3030/api/user/ (with body json {id:1,foo1:"foo",foo2:"foo2"}) (superadmin permission)
DELETE http://localhost:3030/api/user/1 (superadmin permission)

Insomnia export in "tools" for tests

In progress :
Permissions/Groups/Roles Email verification option

fastifystarter's People

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.