1.0.0-rc.4 • Published 2 years ago

@jsnova/core v1.0.0-rc.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Description

The @jsnova/core is a library aimed at facilitating the rapid development of Serverless APIs using AWS CDK with TypeScript. With this library, you can create advanced APIs and perform complex queries on databases without the need to run additional machines or lambda functions. All of this is made possible using just the AWS API Gateway and other functionalities provided by AWS.

Packages

Package nameDescriptionDocs
@jsnova/coreSimplify Serverless API development using AWS CDK, providing a comprehensive toolkit for streamlined implementation.here
@jsnova/model-validatorEnsure data integrity with easy-to-use validation and mapping of API payload data for enhanced endpoint reliability.see docs
@jsnova/atlasSeamless MongoDB Atlas integration through DataAPI, optimizing resource efficiency and reducing database operation costs..see docs

Key Features

  • Rapid Development: Create Serverless APIs quickly and efficiently, reducing code complexity and speeding up the development process.
  • Integration with AWS CDK: The library is built on top of AWS Cloud Development Kit (CDK) with TypeScript, making it powerful and highly customizable.

Installation

To use @jsnova/core, you need to have Node.js and npm installed on your machine. Then, install the library with the following command:

pnpm install @jsnova/core

Creating an app

(async  ()  =>  {
	NovaFactory.create({
	    cors:  true,
	    port:  3000,
	    controllers: [UserController],
	    region:  "us-east-1",
	    use: [
		    useAtlas({
			    apiKey:  getEnv("ATLAS_API_KEY"),
			    appId:  getEnv("ATTLAS_APP_ID"),
			    database:  "test_a",
			    region:  "us-east-1.aws",
			    dataSource:  "dev-hml",
			}),
		],
	});
})();

Creating an controller

import  { InsertOne }  from  "@jsnova/atlas";
import  { Controller, Post }  from  "@jsnova/core";
import  { UseModel }  from  "@jsnova/model-validator";
import  { UserDto }  from  "../models/user.model";

@Controller("user")
class  UserController  {
	@InsertOne("influencers")
	@Post("")
	insertUser(
		@UseModel(UserDto)
		user:  UserDto
	)  {
		return  {
			document:  {
				name: user.name,
				age: user.age,
				address: user.address,
			},
		};
	}
}

export  default UserController;

Extends AWS CDK

Create your cdk.json To deploy use cdk cli

1.0.0-rc.4

2 years ago

1.0.0-rc.3

2 years ago

1.0.0-rc.2

2 years ago

1.0.0-rc.1

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago