Api for telegram bot
First modify the ormconfig.json
file and put your database configuration.
# install deps
npm install
# run in development mode
# server will listen the 3000 port
npm run start
# run tests
npm run test
You can run it in debug mode:
npm run debug
Run npm run swagger:generate
to generate the swagger file from code.
This project comes with these endpoints:
POST
/auth/login
Authenticate the user, return the auth token
{
username: "myusername",
password: "mypassord"
}
POST
/auth/login
Register the user
{
username: "myusername",
password: "mypassord"
}
POST
auth/change-password
Change the user password, you need to put the auth token in the Authorization header
Authorization: Bearer theauthtoken
{
username: "myusername",
password: "mypassord"
}
The swagger document is available at: http://localhost:3000
If you modify the endpoint documentation or add a new one, run the following command:
npm run swagger:generate
To build the production files:
npm run build
# start the server
node build/lib/server.js
You can use docker during your developement process. First, build the docker image:
docker build -t myapp .
And run it:
docker run -p 3000:3000 -v $(pwd):/usr/src/app myapp