-
Notifications
You must be signed in to change notification settings - Fork 0
Server | Home
Mitchell Mastromonaco edited this page Apr 17, 2020
·
14 revisions
- Install dependencies: npm, postgresql (make sure md5 connexion are enabled).
- Change config file:
server/config/default.json, to match port, username and password of your postgresql. - Create an empty postgres database named as the value of the field
database.databaseof the config file. - Run
npm installwithin the server file. - Compile the server once using
npm run tsc. There is a known error within the server onreq.user.name. However, the code should have compiled if you have a file under the directoryserver/out/server/app/by the name ofwww.js. - Populate the database with
npm run seeding-standardornpm run seeding-standard-windowsif on a windows computer. This will ask you if you wish to erase your database. It will not change any other data within your computer, therefore, accept. - If you have any images within your seeding, make sure that all your images, your preprocessings, and your thumbnails are added to the folder
server/storagein folders labeledimages,preprocessings, andthumbnailsrespectively.
Start the server with npm run dev (or npm run start-windows if on a windows computer).
In order to create new files, a few steps must be followed in order to further provide extensibility to the code.
If a controller is created, it must implement the interface abstractController so that the routing can be detected by the express middleware (for further information about routing see Endpoints).
If a repository is created, it must inject the ConnectionProvider in order to have access to the database.
No matter the file created, they must be added to the inversify.config.ts so that they may be correctly updated and compiled by the server.
For a controller:
container.bind<IController>(TYPES.Controller).to(YourNewController);
For a service or repository:
In the types.ts file:
YourNewServiceOrRepository: Symbol.for('YourNewServiceOrRepository')
In the inversify.config.ts file:
container.bind<YourNewServiceOrRepository>(TYPES.Controller).to(YourNewServiceOrRepository);