Skip to content

Morstis/SvAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SvAPI

Development

Steps to run this project:

  1. Run npm i command
  2. 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"
   }
}
  1. 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"
      );
    });
  1. outcomment in index.ts:
   // app.listen(3000, () => {
   //     console.log("Server started on port 3000!");
   // });
  1. Run npm start command

Deployment

  1. install pm2: npm install pm2
  2. add your key and cert in index.ts and comment options out
  3. comment start server http and comment start server https out
  4. Run sudo pm2 start src/index.ts to start the server

About

Hag Sv-Website REST api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages