An API for retrieving and saving words to build a 'word of day' application.
It's also a learning project for various technologies like nodejs, express and mongoose deployment.
The API is documented with swagger/openapi. The resources will automatically mount on startup.
- Integrated swagger UI:
http://localhost:8000/
. - Openapi.yaml:
http://localhost:8000/doc/openapi.yaml
- Swagger.yaml:
http://localhost:8000/doc/swagger.yaml
- Openapi.json:
http://localhost:8000/doc/openapi.json
- Swagger.json:
http://localhost:8000/doc/swagger.json
Create an .env file in src/config
for defining the application properties
Example:
# Example .env file for the application
NODE_ENV=development
PORT=8000
# MongoDB
MONGO_DB_USER=<your-mongo-db-user>
MONGO_DB_PASSWORD=<your-mongo-db-password>
MONGO_DB_HOST=<your mongo-db-host>
MONGO_DB_PORT=<your-mongo-db-port>
MONGO_DB_NAME=<your-mongo-db-name>
# Security
API_KEY=<your-api-key>
The .env.example
file is located at src/config
.
You have to insert your mongoDB connection to the env file. You can use a hosted MongoDB from mLab or host it yourself with provided docker-compose script. If you want to use the docker-compose script, you also have to add an .env file in the mongoDB folder.
Example:
# Example .env file for locally hosted MongoDB
MONGO_DATABASE_NAME=<your-database-name>
MONGO_DATABASE_USER=<your database-user>
MONGO_PASS=<your-password>
MONGO_ROOT_PASS=<your-root-password>
The .env.example
file is located in the mongoDB folder.
npm install
Warning: First run can be really slowly
npm run test
npm run serve
npm run lint
Used various sources to gather the knowledge. I listed some of them to provide you some background knowledge: