A minimalistic framework for typescript based applications, with async/await and decorators support.
The current API is considered to be a "Release Candidate". That means that small, potentially breaking changes may still occur. Be sure to use a specific GIT_REV_HASH and a lock file in your project, so you won't be immediately affected by such a change.
For example:
# Install using Yarn
yarn add git+https://github.com/devnup/ts-framework.git#GIT_REV_HASH
# Install using NPM
npm install --save git+https://github.com/devnup/ts-framework.git#GIT_REV_HASH
Configure a new Server instance and start listening on desired port.
import Server, { Logger, BaseRequest, BaseResponse } from 'ts-framework';
// Define a sample hello world route
const SampleRoutes {
'/': async (req: BaseRequest, res: BaseResponse) => {
res.success({ message: 'Hello world!' });
}
}
// Define the server configuration
const server = new Server({
port: process.env.PORT as any || 3000,
routes: {
get: SampleRoutes,
},
});
// Startup the simple server
server.listen()
.then(() => Logger.info(`Server listening on port: ${server.config.port}`))
.catch(error => {
console.error(error);
process.exit(1);
});
You can also check a full project seed in the Examples directory of this repository.
Follow the Usage Guide for the basic boilerplate and a sample project configuration with Database and user authentication samples.
Internal components:
res.status(code).json(result)
for success and error responses.External components available as built-in middlewares:
Other external plugins and middlewares for this framework
Handles API versioning using HTTP Headers.
Handles transactional notifications using SMTP (email templates) and Firebase Messaging (push notifications).
Advanced usage plugin for handling Schema migrations safely within production environments.
Socket.io layer over the TS-Framework. Currently in public alpha.
ts-framework-queue (coming soon)
Redis based task rotation queue services. Currently in closed alpha.
ts-framework-cache (coming soon)
Redis based cache services for performance. Currently in closed alpha.
ts-framework-sql (coming soon)
MySQL / Postgres database layer based on Sequelize. Currently in closed alpha.
Checkout the rendered TS Docs in the official page: https://devnup.github.io/ts-framework/
To generate the Typedoc reference of the available modules directly from source, run the following command:
yarn run docs
Then check the documentation at ./docs/index.html
.
The project is licensed under the MIT License.
Generated using TypeDoc