Supra Api Nodejs

❤️ Node.js REST API boilerplate
Alternatives To Supra Api Nodejs
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Nodebestpractices89,600
4 days ago47cc-by-sa-4.0Dockerfile
:white_check_mark: The Node.js best practices list (May 2023)
Hoppscotch51,809121 hours ago1March 22, 2022150mitTypeScript
👽 Open source API development ecosystem - https://hoppscotch.io
Rest Assured6,4017,364395a day ago29September 09, 2022511apache-2.0Java
Java DSL for easy testing of REST services
Nodejs Integration Tests Best Practices2,906
a month ago42JavaScript
✅ Beyond the basics of Node.js testing. Including a super-comprehensive best practices list and an example app (April 2022)
Awesome Http Benchmark2,697
4 months ago10mit
HTTP(S) benchmark tools, testing/debugging, & restAPI (RESTful)
Testing Nestjs2,421
7 days ago23mitTypeScript
A repository to show off to the community methods of testing NestJS including Unit Tests, Integration Tests, E2E Tests, pipes, filters, interceptors, GraphQL, Mongo, TypeORM, and more!
Httpexpect2,202701107 days ago23July 20, 202134mitGo
End-to-end HTTP and REST API testing for Go.
Hitchhiker2,113
4 years ago96gpl-2.0TypeScript
a Restful Api test tool
Mongooseim1,548
8 days ago88otherErlang
MongooseIM is Erlang Solutions' robust, scalable and efficient XMPP server, aimed at large installations. Specifically designed for enterprise purposes, it is fault-tolerant and can utilise the resources of multiple clustered machines.
Rest Client1,187
2 years ago5apache-2.0Java
A tool for automated testing REST API, generating exquisite testing report and REST API documentation.
Alternatives To Supra Api Nodejs
Select To Compare


Alternative Project Comparisons
Readme

Node.js API boilerplate

Piece of my thoughts about Node.js architecture.

supra-api-nodejs: A little bit about Node.js RESTful APIs Architecture (RU)

Highlights:

  • Modular RESTful API
  • ES6 Classes
  • Action based
  • SQL based (PostgreSQL with objection.js)
  • Migrations(knex.js)
  • Auth (JWT/Access-token/Refresh-token)
  • Cookie support
  • Role based access control
  • Request validation
  • CRUD(users, posts resources)
  • Automated API documentation
  • Full authentication/authorization and user registration flow implemented
  • Tests(e2e)

Key points:

0. Monolith first

Supra-api-nodejs its about monolith first approach. But this does not prevent you from using it in a microservice architecture as well.

1. Controller layer

Each entity have own controller class it slim layer representing resource mapping(routing)

class PostsController extends BaseController {
  static get router () {
    router.get('/', this.actionRunner(actions.ListAction))
    router.get('/:id', this.actionRunner(actions.GetByIdAction))
    router.post('/', this.actionRunner(actions.CreateAction))
    router.patch('/:id', this.actionRunner(actions.UpdateAction))
    router.delete('/:id', this.actionRunner(actions.RemoveAction))

    return router
  }
}

For example PostsController implements post entity routes. Each route fires own action.

2. Action layer

It's a class encapsulated request validation, permission verification and business logic. One file, one class, one REST operation, one use case.

3. DAO layer

Implement data access methods.

4. Model layer

Represent models schemas and validation rules. There is no other logic only model fields and validation rules.

Development:

Install global dependencies:

npm i -g knex nodemon

Setup database:

  1. Install PostgreSQL (https://postgresapp.com/downloads.html (for Mac OS))
  2. Create some DB (https://eggerapps.at/postico/ (for Mac OS))

Go ahead...

cd /supra-api-nodejs
  • cp .env.example .env
  • Set required credential in .env

Run migration to set base SQL schema

knex migrate:latest

Run server

npm run start // prod mode
npm run dev // dev mode

Implemented endpoints:

/auth

Path Method Description
/auth/login POST LoginAction
/auth/logout POST LogoutAction
/auth/refresh-tokens POST RefreshTokensAction

/users

Path Method Description
/users GET ListUsersAction
/users/current GET GetCurrentUserAction
/users/:id GET GetUserByIdAction
/users POST CreateUserAction
/users PATCH UpdateUserAction
/users/:id DELETE RemoveUserAction
/users/change-password POST ChangePasswordAction
/users/send-reset-password-email POST SendResetPasswordEmailAction
/users/reset-password POST ResetPasswordAction
/users/confirm-registration POST ConfirmRegistrationAction
/users/change-email POST ChangeEmailAction
/users/confirm-email POST ConfirmEmailAction
/users/resend-confirm-new-email-token POST ResendConfirmNewEmailTokenAction
/users/cancel-email-changing POST CancelEmailChangingAction

/posts

Path Method Description
/posts GET ListPostsAction
/posts POST CreatePostAction
/posts/:id GET GetPostByIdAction
/posts/:id PATCH UpdatePostAction
/posts/:id DELETE RemovePostAction

!!! Project still in progress !!!

2017 - 2018 - 2019 - 2020 ...

Popular Rest Projects
Popular Testing Projects
Popular Application Programming Interfaces Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Javascript
Testing
Rest
Authentication
Postgresql
Sql
Email
Validation
Jwt
Cookie
Starter Kit
Framework Agnostic