swtc v2.1.0
SWTC - Start with Testcontainers
A thin wrapper around the testcontainers library, SWTC lets you easily start and configure a network of Docker services before running a node project.
Installation
$ npm install swtc --save-dev
Configuration
After installing SWTC, you will need to create a .swtc.ts
file. This is the location where you can define what services are required before starting your NodeJS entrypoint.
import { GenericContainer, type SwtcConfig } from 'swtc';
const config: SwtcConfig = {
watch: true,
entrypoint: './server.ts',
containers: [
new GenericContainer('mongo').withExposedPorts(27017).onStart((instance) => {
process.env.DB_URI = `mongodb://${instance.getHost()}:${instance.getMappedPort(27017)}`;
}),
],
};
export default config;
Usage
After a .swtc.ts
file is configured, you can start your node process with the following command:
npx swtc
Documentation
Please refer to the SWTC Documentation for more information about setup and configuration.
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.md
for more information.