mirror of
https://github.com/snowball-tools/snowballtools-base.git
synced 2025-01-27 08:30:33 +00:00
ea3addfd61
* Setup backend package with express server (#11) * Setup backend package with express server * Rename ts.config.json to tsconfig.json * Update lint setup in backend package * Add a dummy typeorm entity * Remove dummy entity --------- Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> * Setup database connection (#13) * Setup database connection * Refactor database initialization into separate function * Rename index.ts to server.ts * Use debug package for logging --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com> * Create entities for ER models (#14) * Add entity for domain * Add entity for environment variable * Add entity for project * Add entity for deployment * git ignore db directory * Add entity for organization * Add entity for user organization and project member * Add foreign key user and organization to project --------- Co-authored-by: neerajvijay1997 <111040298+neerajvijay1997@users.noreply.github.com> Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-authored-by: neeraj <neeraj.rtly@gmail.com>
31 lines
627 B
TypeScript
31 lines
627 B
TypeScript
import express, { Request, Response } from 'express';
|
|
import 'reflect-metadata';
|
|
import debug from 'debug';
|
|
|
|
import { initializeDatabase } from './database';
|
|
|
|
const log = debug('snowball:server');
|
|
|
|
export const main = async (): Promise<void> => {
|
|
await initializeDatabase();
|
|
|
|
const app = express();
|
|
const port = 8080;
|
|
|
|
app.get('/', (req: Request, res: Response) => {
|
|
res.send('Hello, TypeScript Express Server!');
|
|
});
|
|
|
|
app.listen(port, () => {
|
|
log(`Server is running at http://localhost:${port}`);
|
|
});
|
|
};
|
|
|
|
main()
|
|
.then(() => {
|
|
log('Starting server...');
|
|
})
|
|
.catch((err) => {
|
|
log(err);
|
|
});
|