Install CLI
You can use heron cli to create new project.
npm i -g @heronjs/cli
Create Project
Get started by creating a project.
mkdir example
cd example
npm init -y
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
The NPM_TOKEN
is required to pull all modules below.
npm install @heronjs/core @heronjs/common @heronjs/express
Create Module
@Module({
imports: [TodosModule],
})
@GateKeeper(AuthContext)
@DataSources([MYSQLDatabase, PostgresDatabase])
@Stores([MemoryCacheConfig])
export class AppModule {}
import 'reflect-metadata';
import { AppModule } from './app';
import { HeronJS } from '@heronjs/core';
const main = async () => {
const app = await HeronJS.create({ module: AppModule });
await app.listen({
port: 3000,
});
};
(async () => main())();
Start Application
npm run start
Your server starts at http://localhost:3000
.