Getting Started
Create your entry file
Once installed, you can easily spin-up the framework by creating yourself an entry file: ./src/main.ts
and then put the following code in it:
All documentation will be written in TypeScript going forward.
typescript
import { Application } from '@sodacore/core';
import HttpPlugin from '@sodacore/http';
const app = new Application({
autowire: true,
// Other settings...
});
app.use(new HttpPlugin({
port: 8080,
}));
app.start().catch(console.error);
Start the framework
You can start the framework by doing:
We suggested to put it in your package.json under
scripts
section and then you can dobun dev
(set it as thedev
script).
zsh
bun run ./src/main.ts --target=bun
We set the target to Bun by default, so that when it launches, it will utilise the bun APIs.
Application configuration
Currently there are only a few settings you can set on the Application:
Setting | Type | Default | Description |
---|---|---|---|
autowire | boolean | true | Whether the application should autowire, if disabled, you will need to import and register your modules manually, using app.register(ModuleClass) . |
basePath | string | process.cwd() | This is used to tell the autowire module where to search for packages, by default it will look in your src folder within the process.cwd(), this is an absolute path. |
logger | instanceof Logger | new Logger() | The logger instance to use, by default it will use the built-in logger, which is a nicely coloured console logger, but you can extend the existing one and pass it in here. |
Next Steps
Well at the moment, you have a basic bun http API application, that is running, but you have defined no paths, so let's add some...