Coder Social home page Coder Social logo

mrtimeey / word-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 675 KB

An API for retrieving and saving words.

Home Page: https://word-of-the-day.de

License: MIT License

JavaScript 98.87% Dockerfile 1.13%
words word-of-the-day word-api api nodejs express mongoose heruko swagger openapi

word-api's Introduction

word-api

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.

Documentation

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

Application env file

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.

MongoDB connection

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.

Project setup

npm install

Run tests

Warning: First run can be really slowly

npm run test

Compiles and hot-reloads for development

npm run serve

Fix all code formatting

npm run lint

Inspiration

Used various sources to gather the knowledge. I listed some of them to provide you some background knowledge:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.