Simple and fast framework to serve API with Fastify and some usefull plugins to create simple API webserwer (and some simple front).
- Scheme of API structure
- Scheme of API endpoits
- Core functions
- Database connection
- Serve static files (styles.css, images etc)
- Authentication
- Authorization (not tested)
- Mailer
- Optional modules
- Firebase (not tested)
- WebSocket
- APISchemas this directory contain scheme of requests and responses to all routes if you create new route you must test it here and commit with route commit!
- assets some useless files like .css or .jpeg which are serve statically when you call http(s)://server:port/assets/you/path/to/file.
- core core app functions like: register plugins, add routes schemas or auth.
- models directory with models of data that are uses in Database to CRUD.
- modules all logic needed for routes.
- routes routes tell app what whitch endpoits are in use and what response are restricted. Allways create schema of route in APISchema!!!
- view if server have static code not only endpoints API use this to show UI.
- Create new model.
- Create new route in routes directory.
- Create logic in modules directory.
- Register route in core/routes.js file.
- Test routes in APISchemas.
- Commit your new part of application.
- Repeat if your are not done.
- On VS code install REST Client extension
- Create directory under APISchemas contain name of your module like: users, orders etc.
- In this directory create every files that's names are name's of your routes with .txt extension.
- Copy/paste of example test and change endpoints (change post body if needed or remove it if request is get/delete)
- Add sample response
- Test it.
- Done :)