Skip to content

Commit 8f47937

Browse files
author
Developer
committed
yolo, got it working
1 parent 47f1a20 commit 8f47937

10 files changed

+5396
-0
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules/
2+
.idea/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules/
2+
.idea/

Dockerfile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM node:alpine AS builder
2+
3+
WORKDIR /app
4+
5+
COPY package.json .
6+
RUN npm install --only=production
7+
8+
FROM node:alpine
9+
10+
WORKDIR /app
11+
12+
COPY --from=builder /app/node_modules ./node_modules
13+
COPY server.js .
14+
15+
EXPOSE 3000
16+
17+
CMD ["node", "server.js"]

Makefile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
##########################################################################
2+
# MENU
3+
##########################################################################
4+
.PHONY: help
5+
help:
6+
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
7+
8+
.PHONY: docker
9+
docker: ## Build the docker container
10+
docker build -t mobiledoc .
11+
12+
.PHONY: test
13+
test: ## Run the tests
14+
npm test

README.md

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# REST-mobiledoc
2+
3+
## Purpose
4+
5+
REST-mobiledoc is an Express.js-based API that converts HTML and Markdown content into the Mobiledoc format. This project provides a simple and efficient way to transform content for use in Mobiledoc-compatible editors or content management systems.
6+
7+
## Why We Made It
8+
9+
We created REST-mobiledoc to bridge the gap between common content formats (HTML and Markdown) and the Mobiledoc format. This tool is particularly useful for developers and content creators who need to:
10+
11+
1. Migrate existing content to Mobiledoc-based systems
12+
2. Provide a conversion layer in their content pipeline
13+
3. Easily transform user-generated content into a Mobiledoc-compatible format
14+
15+
By offering this as a REST API, we've made it easy to integrate into various workflows and applications, regardless of the programming language or platform they use.
16+
17+
## Features
18+
19+
- Convert HTML to Mobiledoc
20+
- Convert Markdown to Mobiledoc
21+
- RESTful API interface
22+
- Swagger documentation for easy API exploration
23+
- Comprehensive error handling
24+
- Fully tested with Jest
25+
26+
## Local Development Setup
27+
28+
To set up REST-mobiledoc in your local development environment, follow these steps:
29+
30+
1. Clone the repository:
31+
```
32+
git clone https://github.com/yourusername/REST-mobiledoc.git
33+
cd REST-mobiledoc
34+
```
35+
36+
2. Install dependencies:
37+
```
38+
npm install
39+
```
40+
41+
3. Start the development server:
42+
```
43+
npm start
44+
```
45+
46+
4. The server will start running at `http://localhost:3000`. You can access the Swagger documentation at `http://localhost:3000/api-docs`.
47+
48+
## Running Tests
49+
50+
To run the test suite:
51+
52+
```
53+
npm test
54+
```
55+
56+
## API Usage
57+
58+
The API exposes a single endpoint:
59+
60+
- `POST /`
61+
62+
Request body:
63+
64+
```json
65+
{
66+
"source": "html" | "markdown",
67+
"payload": "Your content here"
68+
}
69+
```
70+
71+
Response:
72+
73+
```json
74+
{
75+
"result": {
76+
"version": "0.3.1",
77+
"markups": [],
78+
"atoms": [],
79+
"cards": [],
80+
"sections": [
81+
// Mobiledoc sections here
82+
]
83+
}
84+
}
85+
```
86+
87+
For detailed API documentation, refer to the Swagger UI available at `/api-docs` when running the server.
88+
89+
## Contributing
90+
91+
We welcome contributions to REST-mobiledoc! Here's how you can contribute:
92+
93+
1. Fork the repository
94+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
95+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
96+
4. Push to the branch (`git push origin feature/AmazingFeature`)
97+
5. Open a Pull Request
98+
99+
Please make sure to update tests as appropriate and adhere to the existing coding style.
100+
101+
## Issues
102+
103+
If you encounter any problems or have feature requests, please file an issue on the GitHub issue tracker.
104+
105+
## License
106+
107+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.
108+
109+
## Acknowledgments
110+
111+
- Express.js for the web framework
112+
- Marked for Markdown parsing
113+
- JSDOM for HTML parsing
114+
- Jest for testing
115+
- Swagger for API documentation
116+
117+
Thank you to all contributors who have helped shape and improve REST-mobiledoc!

0 commit comments

Comments
 (0)