create-node-template
Version:
Create node.js or express boilerplate with one command
25 lines (20 loc) • 559 B
text/typescript
import express, { Application } from 'express';
import { configVars } from './config';
import { initLoaders } from './loaders';
const { port } = configVars;
const startServer = async (): Promise<void> => {
try {
const app: Application = express();
await initLoaders(app);
app
.listen(port, () => {
console.log('Server listening on port: ', port);
})
.on('error', (error: Error) => {
console.log('Error starting server: ', error.message);
});
} catch (error) {
throw error;
}
};
startServer();