Build an Express server that:
1. Accepts a POST /upload request with a JSON body { "filename": "...", "content": "..." }
2. Writes the content to a file at /tmp/<filename>
3. Responds with { "saved": true, "path": "/tmp/<filename>" }
4. Returns { "error": "Missing filename or content" } with status 400 if either field is missing
5. Prints "Upload server ready" when the server starts, then closes
Focus on: JSON body parsing, input validation, fs.writeFileSync, and correct HTTP status codes.
Build an Express server that:
1. Accepts a POST /upload request with a JSON body { "filename": "...", "content": "..." }
2. Writes the content to a file at /tmp/<filename>
3. Responds with { "saved": true, "path": "/tmp/<filename>" }
4. Returns { "error": "Missing filename or content" } with status 400 if either field is missing
5. Prints "Upload server ready" when the server starts, then closes
Focus on: JSON body parsing, input validation, fs.writeFileSync, and correct HTTP status codes.