Steps to run this project:
- Run
npm i
command - Setup database settings inside
ormconfig.json
file e.g.
"type": "mysql",
"host": "localhost",
"port": 3306,
"username": "user",
"password": "secret",
"database": "db",
"synchronize": true,
"logging": false,
"entities": [
"src/entity/**/*.ts"
],
"migrations": [
"src/migration/**/*.ts"
],
"subscribers": [
"src/subscriber/**/*.ts"
],
"cli": {
"entitiesDir": "src/entity",
"migrationsDir": "src/migration",
"subscribersDir": "src/subscriber"
}
}
- comment in index.ts:
key: readFileSync("/etc/letsencrypt/live/api.sv-hag.de/privkey.pem"),
cert: readFileSync("/etc/letsencrypt/live/api.sv-hag.de/fullchain.pem")
};
// start server https
https.createServer(options, app).listen(3000, function() {
console.log(
"server started with cors at https://localhost:3000 or with the reverse proxy at https://api.sv-hag.de"
);
});
- outcomment in index.ts:
// app.listen(3000, () => {
// console.log("Server started on port 3000!");
// });
- Run
npm start
command
- install pm2:
npm install pm2
- add your key and cert in index.ts and comment
options
out - comment start
server http
and commentstart server https
out - Run
sudo pm2 start src/index.ts
to start the server