This is a template for a basic RESTful API in express with standardized CRUD operations. It's a decent starting point for an extensible application backend.
Get dependencies: npm install
Start the server: npm start
The server will run at http://localhost:3000
by default.
Data operations currently support MongoDB via mongoose
, with more to come later.
The API has some basic services built-in for example purposes:
GET /users
POST /users/register
POST /users/login
GET /profiles
POST /profiles
GET /profiles/{profile_id}
PATCH /profiles/{profile_id}
DELETE /profiles/{profile_id}
POST /calculator
/users
is a basic user entity, and /profiles
is a CRUD extension of the User data model with an id reference. /calculator
is a function call invoked synchronously via POST
with the function arguments passed in the request body. The calculator pattern is useful for exposing API-level orchestrations and/or arbitrary functions in a standard REST format.
- Query filtering
- Query sorting
- Standardized CRUD interface that can be applied to any data schema
- UUID primary keys with optional human-readable prefixes (e.g.
USER-5a57b557-6b3d-4efc-b39e-da74ba49dbc7
) - User password encryption
- Customizable request validation powerd by
joi
forPATCH
andPOST
operations