diff --git a/.env.local_dev b/.env.local_dev index 93eff6132..776e7bcaa 100644 --- a/.env.local_dev +++ b/.env.local_dev @@ -9,7 +9,7 @@ PUBLIC_URL=http://localhost:3000 # Set it to true if you want to generate the Sourcemap for debugging GENERATE_SOURCEMAP=false # Set it to the URL from where APIs will be accessible, for local development it should be localhost:3000/api/app (use your local port number instead) -REACT_APP_SERVERURL=http://localhost:8080/app +REACT_APP_SERVERURL=http://localhost:8080/api/app # A 12 character long random app identifier. The value of this should be same as APP_ID which is a variable used by backend API. REACT_APP_APPID=opensignstgn @@ -26,7 +26,7 @@ MONGODB_URI=mongodb://host.docker.internal:27017/OpenSignDB # Path on which APIs should be mounted. Do not change this. This variable shall be removed & value hardcoded in the source code in coming versions. PARSE_MOUNT=/app # Set it to the URL from where APIs will be accessible to the NodeJS functions, for local development it should be localhost:3000/api/app (use your local port number instead) -SERVER_URL=http://127.0.0.1:8080/app +SERVER_URL=http://127.0.0.1:8080/api/app # Storage config ************************************************************************************************************************************************************************************************ # Digital ocean space name or AWS S3 bucket name for uploading documents diff --git a/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js b/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js index df8b6eacd..e911e3704 100644 --- a/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js +++ b/apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js @@ -1,6 +1,3 @@ -import { customAPIurl } from '../../../../Utils.js'; - -const randomId = () => Math.floor(1000 + Math.random() * 9000); export default async function createTemplate(request, response) { const name = request.body?.title; const note = request.body?.note; diff --git a/apps/OpenSignServer/index.js b/apps/OpenSignServer/index.js index 896a11bdd..94b03489e 100644 --- a/apps/OpenSignServer/index.js +++ b/apps/OpenSignServer/index.js @@ -84,9 +84,9 @@ export const config = { maxLimit: 500, masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret! masterKeyIps: ['0.0.0.0/0', '::1'], // '::1' - serverURL: process.env.SERVER_URL || 'http://localhost:8080/app', // Don't forget to change to https if needed + serverURL: process.env.SERVER_URL || 'http://localhost:8080/api/app', // Don't forget to change to https if needed verifyUserEmails: process.env.SMTP_ENABLE || process.env.MAILGUN_API_KEY ? true : false, - publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app', + publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/api/app', // Your apps name. This will appear in the subject and body of the emails that are sent. appName: 'Open Sign', allowClientClassCreation: false, @@ -175,11 +175,11 @@ app.use(function (req, res, next) { next(); }); // Serve static assets from the /public folder -app.use('/public', express.static(path.join(__dirname, '/public'))); +app.use('/api/public', express.static(path.join(__dirname, '/public'))); // Serve the Parse API on the /parse URL prefix if (!process.env.TESTING) { - const mountPath = process.env.PARSE_MOUNT || '/app'; + const mountPath = process.env.PARSE_MOUNT || '/api/app'; try { const server = new ParseServer(config); await server.start(); @@ -189,17 +189,17 @@ if (!process.env.TESTING) { } } // Mount your custom express app -app.use('/', customRoute); +app.use('/api', customRoute); // Mount v1 -app.use('/v1', v1); +app.use('/api/v1', v1); // Parse Server plays nicely with the rest of your web routes -app.get('/', function (req, res) { +app.get('/api', function (req, res) { // res.statusCode = 200; // res.setHeader('Content-Type', 'text/plain'); // res.end('I dream of being a website. Please star the parse-server repo on GitHub!'); - res.status(200).send('open-sign-server is running !!!'); + res.status(200).send('opensign-server is running !!!'); }); if (!process.env.TESTING) { @@ -209,13 +209,13 @@ if (!process.env.TESTING) { httpServer.keepAliveTimeout = 100000; // in milliseconds httpServer.headersTimeout = 100000; // in milliseconds httpServer.listen(port, function () { - console.log('parse-server-example running on port ' + port + '.'); + console.log('opensign-server running on port ' + port + '.'); const isWindows = process.platform === 'win32'; // console.log('isWindows', isWindows); const migrate = isWindows - ? `set APPLICATION_ID=${process.env.APP_ID}&& set SERVER_URL=http://localhost:8080/app&& set MASTER_KEY=${process.env.MASTER_KEY}&& npx parse-dbtool migrate` - : `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`; + ? `set APPLICATION_ID=${process.env.APP_ID}&& set SERVER_URL=http://localhost:8080/api/app&& set MASTER_KEY=${process.env.MASTER_KEY}&& npx parse-dbtool migrate` + : `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/api/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`; exec(migrate, (error, stdout, stderr) => { if (error) { console.error(`Error: ${error.message}`);