create-node-template
Version:
Create node.js/express boilerplate with one command
27 lines (22 loc) • 617 B
text/typescript
import express, { Application } from 'express';
import { configVars } from './config/index.js';
import { initLoaders } from './loaders/index.js';
const { port } = configVars;
const startServer = () => {
try {
const app: Application = express();
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) {
// TODO error-handling
console.log('🚀 error:', error);
throw error;
}
};
startServer();