Skip to content
Snippets Groups Projects
README.md 1.56 KiB
Newer Older
Peter Kuhn's avatar
Peter Kuhn committed
# Core-engine
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
Backend for citizen participation chatbot. Designed to work with the webplugin
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
## Getting Started
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
The server is written in Reactjs using TypeScript  
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
## Prerequisites
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
Install the latest npm package manager and nodejs 
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
**Current version** 
- npm (v6.4.0) https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
- nodejs(v8.11.2)   https://nodejs.org/en/
Peter Kuhn's avatar
Peter Kuhn committed


Peter Kuhn's avatar
Peter Kuhn committed
### Installing
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
After cloning, go to the root folder from the terminal and run :
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
```
npm install
```
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
## Running 
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
Run the following  command from the terminal to start the server,
```
npm start
```
When the server runs successfully , it will display
```
Server started on port 3999 
```
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
since we are using websocket the url used to connect to the server should look like that  [ws://localhost:3999](ws://localhost:3999)
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
## Deployment
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
There are many ways to deploy a nodejs app, but for the sake of simplicity we will use a package called [forever](https://www.npmjs.com/package/forever).
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
[forever](https://www.npmjs.com/package/forever) is a simple CLI tool for ensuring that a given script runs continuously,
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
Run the following command from the terminal to start the [forever](https://www.npmjs.com/package/forever) mode, check forever documentation for more advanced usage [here](https://www.npmjs.com/package/forever).
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
```
npm run start:forever
```
Add this command to the Cron jobs in linux or windows scheduler to run the server on restart.
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
## Built With
Peter Kuhn's avatar
Peter Kuhn committed

Peter Kuhn's avatar
Peter Kuhn committed
* [NodeJS](https://nodejs.org/en/) - The javascript framework used
* [Typescript](https://www.typescriptlang.org/) - For easier OOP javascript
Peter Kuhn's avatar
Peter Kuhn committed