Skip to content

Commit 692ec8e

Browse files
authored
Merge pull request #432 from OpenSignLabs/revert-431-fix_server_route
Revert "fix: mount server app on /api for local development"
2 parents f48444f + 523ea7f commit 692ec8e

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

.env.local_dev

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ PUBLIC_URL=http://localhost:3000
99
# Set it to true if you want to generate the Sourcemap for debugging
1010
GENERATE_SOURCEMAP=false
1111
# 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)
12-
REACT_APP_SERVERURL=http://localhost:8080/api/app
12+
REACT_APP_SERVERURL=http://localhost:8080/app
1313
# 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.
1414
REACT_APP_APPID=opensignstgn
1515

@@ -26,7 +26,7 @@ MONGODB_URI=mongodb://host.docker.internal:27017/OpenSignDB
2626
# 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.
2727
PARSE_MOUNT=/app
2828
# 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)
29-
SERVER_URL=http://127.0.0.1:8080/api/app
29+
SERVER_URL=http://127.0.0.1:8080/app
3030

3131
# Storage config ************************************************************************************************************************************************************************************************
3232
# Digital ocean space name or AWS S3 bucket name for uploading documents

apps/OpenSignServer/cloud/customRoute/v1/routes/createTemplate.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { customAPIurl } from '../../../../Utils.js';
2+
3+
const randomId = () => Math.floor(1000 + Math.random() * 9000);
14
export default async function createTemplate(request, response) {
25
const name = request.body?.title;
36
const note = request.body?.note;

apps/OpenSignServer/index.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ export const config = {
8484
maxLimit: 500,
8585
masterKey: process.env.MASTER_KEY, //Add your master key here. Keep it secret!
8686
masterKeyIps: ['0.0.0.0/0', '::1'], // '::1'
87-
serverURL: process.env.SERVER_URL || 'http://localhost:8080/api/app', // Don't forget to change to https if needed
87+
serverURL: process.env.SERVER_URL || 'http://localhost:8080/app', // Don't forget to change to https if needed
8888
verifyUserEmails: process.env.SMTP_ENABLE || process.env.MAILGUN_API_KEY ? true : false,
89-
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/api/app',
89+
publicServerURL: process.env.SERVER_URL || 'http://localhost:8080/app',
9090
// Your apps name. This will appear in the subject and body of the emails that are sent.
9191
appName: 'Open Sign',
9292
allowClientClassCreation: false,
@@ -175,11 +175,11 @@ app.use(function (req, res, next) {
175175
next();
176176
});
177177
// Serve static assets from the /public folder
178-
app.use('/api/public', express.static(path.join(__dirname, '/public')));
178+
app.use('/public', express.static(path.join(__dirname, '/public')));
179179

180180
// Serve the Parse API on the /parse URL prefix
181181
if (!process.env.TESTING) {
182-
const mountPath = process.env.PARSE_MOUNT || '/api/app';
182+
const mountPath = process.env.PARSE_MOUNT || '/app';
183183
try {
184184
const server = new ParseServer(config);
185185
await server.start();
@@ -189,17 +189,17 @@ if (!process.env.TESTING) {
189189
}
190190
}
191191
// Mount your custom express app
192-
app.use('/api', customRoute);
192+
app.use('/', customRoute);
193193

194194
// Mount v1
195-
app.use('/api/v1', v1);
195+
app.use('/v1', v1);
196196

197197
// Parse Server plays nicely with the rest of your web routes
198-
app.get('/api', function (req, res) {
198+
app.get('/', function (req, res) {
199199
// res.statusCode = 200;
200200
// res.setHeader('Content-Type', 'text/plain');
201201
// res.end('I dream of being a website. Please star the parse-server repo on GitHub!');
202-
res.status(200).send('opensign-server is running !!!');
202+
res.status(200).send('open-sign-server is running !!!');
203203
});
204204

205205
if (!process.env.TESTING) {
@@ -209,13 +209,13 @@ if (!process.env.TESTING) {
209209
httpServer.keepAliveTimeout = 100000; // in milliseconds
210210
httpServer.headersTimeout = 100000; // in milliseconds
211211
httpServer.listen(port, function () {
212-
console.log('opensign-server running on port ' + port + '.');
212+
console.log('parse-server-example running on port ' + port + '.');
213213
const isWindows = process.platform === 'win32';
214214
// console.log('isWindows', isWindows);
215215

216216
const migrate = isWindows
217-
? `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`
218-
: `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/api/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;
217+
? `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`
218+
: `APPLICATION_ID=${process.env.APP_ID} SERVER_URL=http://localhost:8080/app MASTER_KEY=${process.env.MASTER_KEY} npx parse-dbtool migrate`;
219219
exec(migrate, (error, stdout, stderr) => {
220220
if (error) {
221221
console.error(`Error: ${error.message}`);

0 commit comments

Comments
 (0)